# Select Database
Use MySQL
# return to the list of available databases
SHOW DATABASES
# Returns the tables available in the current database
SHOW TABLES
# return table columns
SHOW COLUMNS from DB
# Show creation statements for a specific database
SHOW CREATE DATABASE MySQL
# Displays extensive server status information
SHOW STATUS
# Show security permissions for authorized users
SHOW GRANTS
Multiple SQL statements must be separated by semicolons.
SQL statements are case-insensitive and habitually capitalized.
Retrieve different rows with DISTINCT, returning only different values.
Limit result, limit clause
LIMIT 5 returns no more than 5 rows.
LIMIT 3,4 4 lines starting from line 3
LIMIT 4 OFFSET 3 (results ibid.) "MySQL5 support Later"
ORDER BY clause ordering
Desc/asc specifying the sort direction
the WHERE clause, where theORDER by is located .
Operator |
Description |
= |
Equals |
<> |
Not equal to |
!= |
Not equal to |
< |
Less than |
<= |
Less than or equal |
> |
Greater than |
>= |
Greater than or equal |
Between |
Between a specified two values |
NULL No value
The WHERE * * is null check field has no null value.
and OR operators.
The in operator is used to specify a range of criteria, and multiple legal values are separated by commas.
The not negation operator, which supports negation of in ,between , and EXISTS clauses.