1. Data Manipulation Language (DML)
a. SELECT - retrieve data
b. INSERT - store data
c. UPDATE - modify data
d. DELETE - remove data
e. MERGE - store/modify data
f. EXPLAIN PLAN - show execution plan
g. LOCK TABLE - restrict access to a table
2. Data Definition Langauge (DDL)
a. CREATE - create new database object
b. ALTER - alter existing database object
c. DROP - remove an existing object permenantly
d. RENAME - modify the name of an existing object
e. TRUNCATE - remove all rows from a table without dropping its structure
f. GRANT
g. REVOKE
h. AUDIT
i. NOAUDIT
j. COMMENT - add info into data dictionary
3. Transaction Control
a. COMMIT
b. ROLLBACK
c. SAVE POINT
d. SET TRANSACTION
4. Session Control
a. ALTER SESSION
b. SET ROLE
5. System Control
a. ALTER SYSTEM
Data Types
1. Character
a. CHAR (n); 1 <= n <= 2000 bytes, default = 1
b. NCHAR (n)
c. VARCHAR2 (n); 1 <= n <= 4000 bytes; MUST specify value for n
d. NVARCHAR2 (n)
2. Number
a. NUMBER (n,m); 1 <= n <= 38, -84 <= m <= 127; IF n and m are missing, assume NUMBER (38, 127) or NUMBER (38, -84)
3. Long and Raw
4. Date and Time
5. Large Object
6. Row ID
Operators
1. Arithmetic Operators
-> +/-, +, -, *, /
2. Concatenation Operator
-> ||
3. Set Operators
-> UNION, UNION ALL, INTERSECT, MINUS
4. Logical Operators
-> NOT, AND, OR
5. Others
-> IN, NOT IN, BETWEEN...AND, EXISTS, IS NULL, IS NOT NULL, LIKE
** Operator precedence: +/- then *, / then +, -, ||
Literals (constant values)
1. Text: 'this is a line of text'
2. Integer: 12, -90 (maximum up to 38 digits)
3. Number: 3, -4.23, 7E-10
4. Interval
CASE Expression
1. CASE column WHEN equal_to_value THEN return_value ELSE default_return_value END
2. CASE WHEN condition THEN return_value ELSE default_return_value END
Notes:
1. Keywords, table names and column names are case insensitive
2. DUAL table is a single row and single column table
3. By default, NULL values are sorted last (unless NULLS FIRST is specified)
4. Equility test for NULL will return 0 row (e.g. WHERE column = NULL)
No comments:
Post a Comment