Docsity

SQL Commands Cheat Sheet, Cheat Sheet of Database Management Systems (DBMS)

Partial preview of the text

Download SQL Commands Cheat Sheet and more Cheat Sheet Database Management Systems (DBMS) in PDF only on Docsity!

runt Sie SQL-COMMANDS % & & § § 9 & = = calories_table a B: e |cal_per typ _per_g£ ismea SELECT DISTINCT (type) 8 @ m pall tunes “ : wrong : FROM fruits O = ’ wees ‘ : Seal?! fitype, tn Wy COUNT(name) AS amount pe in ay a). . c.cal_per_g @) FROM fruits =| c.cal_per_g * f.weight AS calories GROUP BY type | Acie tes (22 SELECT* [—1__ HAVING COUNT <3 " SELECT * 4 OY } . inane) LEFT JOIN calories_table AS c FROM fruits PRON fruits OR y | INNER, int ON f.type = c.type ORDER BY < : : weight DESC e ASC, eness DESC WITH fresh_stuff AS ( = SELECT * aoe FROM fruits DECLARE today DATE DEFAULT CURRENT_DATE(); ncaa aL SELECT name, type, we ight, ripeness SELECT 5 FROM fruits name, WHERE I ® CASE | ripeness < CURRENT_DATE() WHEN (ripeness < today) THEN ,,bad“ WHEN (ripeness = today) THEN ,,eat now" G) , Q END AS to_eat_or_not_to_eat & 4% SELECT weight AS weight\ in _g FROM fruits 4 YY CROTON] % mie