MYSQL Basics to know ….PART -2

 

MYSQL Basics to know ….PART -2

LoL…I used my YouTube channel name for syntax.

YOUTUBE CHANNEL

REVERSE(): This command reverses a string.

REVERSE( ) syntax

SUBSTRING( ): It works with parts of strings.

SUBSTRING( ) syntax

UPPER(): Converts a string into upper-case.

UPPER( ) syntax

LOWER( ) : Converts a string into lower-case.

LOWER( ) syntax

CONCAT () : This command adds two or more strings together.

CONCAT( ) syntax

CONCAT_WS (): Concat two or more strings into one string with a separator.

CONCAT_WS ( ) syntax

REPLACE( ): Replaces parts(characters)of a string with another set of characters.

REPLACE( )syntax

DISTINCT( ): It collects unique values and it won’t show any duplicate values in the table.

DISTINCT( ) syntax

ORDER BY( ): This command is used to sort the values in Ascending or Descending order. ASC -Ascending order, DESC-Descending order. In the below syntax the output shows in ascending order. Ascending by default.

ORDER BY( ) syntax in Ascending order

DESC -Descending order

ORDER BY( ) syntax in Descending order

LIMIT( ): It shows several records or number of values as specified in the syntax.

LIMIT( ) -It shows only 3 values(titles) in a table
LIMIT( ) -It shows only 1 record(row)

LIKE ( ): This command shows exact matching values/pattern matching. In the below syntax ‘%a%’- Finds any value that has “a” in any position.

LIKE( ) command

‘e%’-finds any values that start with e.

LIKE( ) command

‘%y’-finds any values that end with y.

LIKE( ) Command

GROUP BY( ): It groups rows that have the same values in the table.

Inserted another value in the table

INSERTED another value in the table

Over here GROUP BY command takes both the rows as one because of same title,author_fname,author_lname,released_year,stock_quantity,pages-‘To Kill a Mockingbird’,’christopher’,’sergel’,1970,42,128.

GROUP( ) syntax

Comments

Popular posts from this blog

MYSQL - “LIKE operator”