3. 3
Structured Query Language
●
Domain Specific Language
– Data Query Language (SELECT)
– Data Definition Language (CREATE TABLE)
– Data Control Language (GRANT)
– Data Manipulation Language
(INSERT / UPDATE / DELETE)
●
Relational Database Management System
4. 4
Standard
●
SQL-86 SQL-89 SQL-92
●
SQL:1999 (SQL3)
– Common Table Expression
– GROUPING SETS, ROLLUP and CUBE
●
SQL:2003
– Window Function
– Filter
●
SQL:2006 (XML) SQL:2008 SQL:2011 (Temporal)
SQL:2016 (JSON, LISTAGG)
6. 6
Data Query Language
SELECT <expression>, …
FROM <table>, …
WHERE <condition>, …
GROUP BY <grouping>, …
HAVING <expression>, …
ORDER BY <expression> ASC|DESC, …
31. 31
Window Function: RANGE | ROWS
●
RANGE:
– CURRENT ROW:
●
<start>: first row of peer rows (from ORDER BY)
●
<end>: last row of peer rows (from ORDER BY)
– No <value> PRECEDING | FOLLOWING
●
ROWS:
– CURRENT ROW:
●
Always current row