(Diagram of how the SQL standard evolves over time)
Class demos and all programming assignments use MySQL, which adheres fairly closely to the standard.
SQL is a big language, not just queries and updates.
Components of the language:
CREATE TABLE name (att1 type1, att2 type2, ..., attN typeN) DROP TABLE nameSee textbook for details of types.
SELECT, INSERT, DELETE, UPDATE
SELECT A1, A2, ..., An FROM R1, R2, ..., Rm WHERE conditionEquivalent to relational algebra query:
PROJECT_{A1, A2, ..., An} SELECT_{condition} (R1 X R2 X ... X Rm)
Returns unnamed relation whose schema is (A1, A2, ..., An)
Student(ID, name, GPA, sizeHS) // ID is key Campus(location, enrollment, rank) // location is key Apply(ID, location, major, decision) // (ID,location,major) is keyConstructs covered:
LIKE predicate
SELECT *
SELECT with arithmetic
UNION, INTERSECT, EXCEPT
IN, NOT IN, EXISTS, NOT EXISTS, ALL, ANY
FROM and SELECT
COUNT DISTINCT
GROUP BY and HAVING
INSERT, DELETE, UPDATE
SELECT attributes, aggregates FROM relations WHERE condition GROUP BY grouping attributes HAVING conditions on aggregates ORDER BY attributes, aggregates=> All optional except
SELECT and FROM
("Flowchart" of clause evaluation)