By Kevin Kline
With
Daniel Kline
Cover | Table of Contents | Colophon
|
Category
|
Example Datatypes and Abbreviations
|
Description
|
|---|---|---|
|
binary
|
binary large object (BLOB)
|
This datatype stores binary string values in hexadecimal format.
|
|
bit string
|
bit
bit varying
|
These datatypes store either binary or hexadecimal data.
BIT has a fixed length, while BIT
VARYING has a variable length.
|
|
boolean
|
SELECT select_list FROM table_list WHERE search_criteria
SELECT expense_date, expense_amount, expense_description FROM expenses WHERE employee_last_name = 'Fudd' AND employee_first_name = 'Elmer'
SELECT au_fname, au_lname, state FROM authors
au_fname au_lname state -------------------- ---------------------------------------- ----- Johnson White CA Marjorie Green CA Cheryl Carson CA Michael O'Leary CA
|
Vendor
|
Command
|
|---|---|
|
SQL Server
|
Supported, with variations
|
|
MySQL
|
Not supported
|
|
Oracle
|
Supported, with variations
|
|
PostgreSQL
|
Not supported
|
ALTER PROCEDURE procedure_name {CASCADE | RESTRICT}
[LANGUAGE | PARAMETER STYLE | <SQL data access> | <null clause behavior> | DYNAMIC RESULT SETS | NAME]
[parameter datatype [,...n]
|
Vendor
|
Command
|
|---|---|
|
SQL Server
|
Supported, with variations
|
|
MySQL
|
Supported, with limitations
|
|
Oracle
|
Supported, with variations
|
|
PostgreSQL
|
Supported, with variations
|
ALTER TABLE table_name
[ADD [COLUMN] column_name datatype attributes]
| [ALTER [COLUMN] column_name SET DEFAULT default_value]
| [ALTER [COLUMN] column_name DROP DEFAULT]
| [ALTER [COLUMN] column_name ADD SCOPE table_name
| [ALTER [COLUMN] column_name DROP SCOPE {RESTRICT | CASCADE}]
| [DROP [COLUMN] column_name {RESTRICT | CASCADE}]
| [ADD table_constraint_name]
| [DROP CONSTRAINT table_constraint_name {RESTRICT | CASCADE}]
|
Vendor
|
Command
|
|---|---|
|
SQL Server
|
Supported, with variations
|
|
MySQL
|
Not supported
|
|
Oracle
|
Supported, with variations
|
|
PostgreSQL
|
Not supported
|
ALTER TRIGGER trigger_name
ON {table_name | view_name}
[WITH ENCRYPTION]
{FOR | AFTER | INSTEAD OF} {[DELETE] [,] [INSERT] [,] [UPDATE]}
[WITH APPEND]
[NOT FOR REPLICATION]
AS
T-SQL_block
| [FOR { [INSERT] [,] [UPDATE] }
[NOT FOR REPLICATION]
AS
{ IF UPDATE(column) [{AND | OR} UPDATE(column)] [...n]
|
IF (COLUMNS_UPDATED( ) {bitwise_operator} updated_bitmask)
{ comparison_operator} column_bitmask [...n] }
T-SQL_block ] } ]
|
Vendor
|
Command
|
|---|---|
|
SQL Server
|
Supported, with variations
|
|
MySQL
|
Not supported
|
|
Oracle
|
Supported, with variations
|
|
PostgreSQL
|
Not supported
|
ALTER VIEW view_name [(column [,...n])] [WITH {ENCRYPTION | SCHEMABINDING | VIEW_METADATA] AS select_statement [WITH CHECK OPTION]
|
Vendor
|
Command
|
|---|---|
|
SQL Server
|
Not supported
|
|
MySQL
|
Not supported
|
|
Oracle
|
Supported
|
|
PostgreSQL
|
Supported
|
CALL procedure_name [(parameter [,...n] )]
CALL [schema.][{type_name | package_name}.]procedure_name@dblink
[(parameter [,...n] )]
[INTO :variable_name [INDICATOR :indicator_name] ]
|
Vendor
|
Command
|
|---|---|
|
SQL Server
|
Supported
|
|
MySQL
|
Supported
|
|
Oracle
|
Not Supported (refer to the DECODE function in
vendor documentation for similar functionality)
|
|
PostgreSQL
|
Supported
|
-- Simple comparison operation CASE input_value WHEN when_condition THEN resulting_value [...n] [ELSE else_result_value] END -- Boolean searched operation CASE WHEN Boolean_condition THEN resulting_value [...n] [ELSE else_result_expression] END
|
Vendor
|
Command
|
|---|---|
|
SQL Server
|
Supported
|
|
MySQL
|
Not supported
|
|
Oracle
|
Not supported
|
|
PostgreSQL
|
Supported
|
CAST(expression AS data_type[(length)])
SELECT CAST(ytd_sales AS CHAR(5)) + "Copies sold of " + CAST(title AS VARCHAR(30)) FROM titles WHERE ytd_sales IS NOT NULL AND ytd_sales > 10000 ORDER BY ytd_sales DESC
|
Vendor
|
Command
|
|---|---|
|
SQL Server
|
Supported
|
|
MySQL
|
Not supported
|
|
Oracle
|
Supported
|
|
PostgreSQL
|
Supported
|
CLOSE { cursor_name }
DECLARE employee_cursor CURSOR FOR SELECT lname, fname FROM pubs.dbo.authors WHERE lname LIKE 'K%' OPEN employee_cursor FETCH NEXT FROM employee_cursor WHILE @@FETCH_STATUS = 0 BEGIN FETCH NEXT FROM Employee_Cursor END CLOSE employee_cursor DEALLOCATE employee_cursor
|
Vendor
|
Command
|
|---|---|
|
SQL Server
|
Supported, with variations
|
|
MySQL
|
Not supported
|
|
Oracle
|
Supported
|
|
PostgreSQL
|
Supported
|
COMMIT [WORK]