SQL Code Snippers

SQL – PostgreSQL Aggregation – Basic SELECT DISTINCT naam FROM steden WHERE LEFT(stadsnaam, 1) IN (‘A’,’B’,’C’,’D’,’E’) ORDER BY stadsnaam SELECT COUNT(*) FROM batsman_scored WHERE batsman_scored.runs_scored = 6; SELECT COUNT(DISTINCT(nationality)) FROM athletes ; SELECT item, CASE WHEN energy > 300 THEN ‘high’ WHEN energy > 150 THEN ‘medium’ ELSE ‘low’ END AS calorie_rating FROM food ORDER […]