Product Home
DTM SQL editor Online Documentation
General
Product profile
Product versions
Database tools
Install software
Upgrade software
Uninstall software
System requirements
How to buy
Product features
User interface
Hot keys
SQL editor
Search and replace
Data export
SQL library
Results viewer
Connect to database
Macros: definition and using
Database schema viewer
Find database object
Data editor
Schema object
Filter database schema
Version control
Command line options
Settings and options
SQL builder
SQL builder
Select type of the statement
Specity objects for select
Build WHERE cause
Select tables or views
Select one table or view
Select fields
Set or change values
ORDER BY and GROUP BY
Create table
Create index
Create view
Plug-ins and SDK
Plug-ins and SDK
Data structures
Plug-in sample, sources
Plug-ins Library
General information
Directory by DBMS
MS SQL Server
Run Query Analyzer
Oracle
Run SQL*Plus
General
Insert Module Header
External preprocessor
Run external tool
Run after script execution
Save/Load Hisroty
Send script by e-mail
Simply preprocessor
WinDiff interface
Directory by functions
Editor plug-ins
Insert Module Header
Run external tool
Run Oracle SQL*Plus
Run MS Query Analyzer
Send script by e-mail
Schema plug-ins
Results plug-ins
Common plug-ins
Run WinDiff
Save/Load Hisroty
Preporcessors
External preprocessor
Simply preprocessor
After execution plug-ins
Run after script execution
Information
Licence agreemnet
Technical support
Send feedback
FAQ and tips
Program tutorial
Troubleshooting guide
Glossary
SQL reference
SQL quick reference

SQL quick reference

Syntax notation in this guide

  • [] - optional construction
  • {} - repeatable construction
  • INSERT - keywords

 

Syntax definition

Example

SELECT [predicate]

{ * |table.* | [table.]field_1 [AS alias_2] [, [table.]field_2 [AS alias_2] [, ...]]}

FROM statement [, ...]

[WHERE... ]

[GROUP BY... ]

[HAVING... ]

[ORDER BY... ]

select A as "Value", B as "Sum"
from MyTable
where A>B and A>0
order by B

INSERT syntax for add one record:

INSERT INTO table [(field_1[, field_2[, ...]])]

VALUES (value_1[, value_2[, ...])

 

Syntax for subquery based INSERT:

INSERT INTO table [(field_1[, field_2[, ...]])]

SELECT [source.]field_1[, field_2[, ...] FROM-expression

insert into MyTable (A,B)
values (5,80)

DELETE [table.*]

FROM table

WHERE selection_condition

delete from MyTable
where A>470

UPDATE table

SET { field = expression_for_new_value }

[WHERE selection_condition]

update MyTable
set A=40
where A<25

DROP <object type> <object name>
 

Object types: table, view, index, etc.

 drop table MyTable

CREATE TABLE <table name>

( field_description,... [CONSTRAINT <constraint>])
 

<field description> ::= <field name> <field type>

<constraint> ::= <constraint_name> PRIMARY KEY (<fields name list>)

create table MyTable
( A integer,
  B decimal
)

GRANT statement[,...]
TO account[,...]

or

GRANT permission[,...]
ON object[,...]
TO account[,...]

GRANT DROP DATABASE, CREATE TABLE
TO Mary, Peter

GRANT INSERT, UPDATE, DELETE
ON Rating
TO Tom

REVOKE statement[,...]
FROM account[,...]

or

REVOKE permission[,...]
ON object[,...]
FROM account[,...]

REVOKE CREATE TABLE
FROM Mary

REVOKE INSERT
ON Rating
FROM Tom