SQL basics- complete reference guide - part1 - DML

Part1: DML-Data Manipulation Language

CommandDescriptionSYNTAXExample
SELECTSelects data from a table or multiple tables.SELECT [ TOP term ] [ DISTINCT | ALL ] selectExpression [,...]
FROM tableExpression [,...] [ WHERE expression ]
[ GROUP BY expression [,...] ] [ HAVING expression ]
[ { UNION [ ALL ] | MINUS | EXCEPT | INTERSECT } select ] [ ORDER BY order [,...] ]
[ LIMIT expression [ OFFSET expression ] [ SAMPLE_SIZE rowCountInt ] ]
[ FOR UPDATE ]
INSERTInserts a new row / new rows into a table.INSERT INTO tableName [ ( columnName [,...] ) ]
{ VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | [ DIRECT ] [ SORTED ] select }
UPDATEUpdates data in a table.UPDATE tableName [ [ AS ] newTableAlias ]
SET { columnName= { DEFAULT | expression } } [,...]
[ WHERE expression ]
DELETEDeletes rows form a table.DELETE FROM tableName [ WHERE expression ]
BACKUPBacks up the database files to a .BACKUP TO fileNameString
CALLCalculates a simple expression.CALL expression
EXPLAINShows the execution plan for a statement.EXPLAIN { [ PLAN FOR ] | ANALYZE } { select | insert | update | delete | merge }
MERGEUpdates existing rows, and insert rows that don't exist.MERGE INTO tableName [ ( columnName [,...] ) ]
[ KEY ( columnName [,...] ) ]
{ VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | select }
RUNSCRIPTRuns a SQL script from a file.RUNSCRIPT FROM fileNameString [ scriptCompression ]
[ CIPHER cipher PASSWORD string ] [ CHARSET charsetString ]
SCRIPTCreates a SQL script from the database.SCRIPT [ SIMPLE ] [ NODATA ] [ NOPASSWORDS ] [ NOSETTINGS ]
[ DROP ] [ BLOCKSIZE blockSizeInt ]
[ TO fileNameString [ scriptCompression ]
    [ CIPHER cipher PASSWORD string ] ]
[ CHARSET charsetString ]
SHOWLists the schemas, tables, or the columns of a table.SHOW { SCHEMAS | TABLES [ FROM schemaName ] |
    COLUMNS FROM tableName [ FROM schemaName ] }

No comments :

Post a Comment

Your Comment and Question will help to make this blog better...