H2 Database: Data Manipulation Cheat Sheet

Select

SELECT * FROM table_name;

Insert

INSERT INTO tableName 
{ [ ( columnName [,...] ) ] 
{ VALUES 
{ ( { DEFAULT | expression } [,...] ) } [,...] | [ DIRECT ] [ SORTED ] select } } | 
{ SET { columnName = { DEFAULT | expression } } [,...] }

Update

UPDATE tableName [ [ AS ] newTableAlias ] SET 
{ { columnName = { DEFAULT | expression } } [,...] } | 
{ ( columnName [,...] ) = ( select ) } 
[ WHERE expression ] [ ORDER BY order [,...] ] [ LIMIT expression ]

Delete

DELETE [ TOP term ] FROM tableName [ WHERE expression ] [ LIMIT term ]

Backup

BACKUP TO fileNameString;

Call

CALL expression;

Explain

EXPLAIN { [ PLAN FOR ] | ANALYZE } { select | insert | update | delete | merge} 

Merge

MERGE INTO tableName [ ( columnName [,...] ) ] 
[ KEY ( columnName [,...] ) ] 
{ VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | select } 

Show

SHOW { SCHEMAS | TABLES [ FROM schemaName ] | 
COLUMNS FROM tableName [ FROM schemaName ] } 

Leave a Reply

Your email address will not be published. Required fields are marked *