SQL Commands Reference

Test yourself on SQL with exam style questions, marked instantly.

Flashcards that come back just before you would forget them.

A revision plan that remembers what you know and shows what to do next.

See which topics you have nailed and which need another look.

Quiz yourself on SQLGet your flashcardsBuild my revision planTrack my progress

SQL Commands Reference

Five panels run in order on a Students table with columns id, name and grade. Start: 1 Alex 7 and 2 Jo 6. SELECT name, grade FROM Students WHERE grade > 6 returns Alex 7 only, because Jo has 6. INSERT INTO Students VALUES (3, 'Sam', 8) adds row 3 Sam 8, giving Alex 7, Jo 6 and Sam 8. UPDATE Students SET grade = 9 WHERE name = 'Alex' changes Alex to 9, giving Alex 9, Jo 6 and Sam 8. DELETE FROM Students WHERE name = 'Jo' removes Jo, leaving Alex 9 and Sam 8.

The commands run in order on one table, so each table is the result of the command above it. SELECT, FROM and WHERE are on AQA and OCR. INSERT, UPDATE and DELETE are on AQA only. Edexcel has no SQL.

Warning: if you leave out WHERE, the command changes every row. UPDATE Students SET grade = 9 sets every grade to 9, and DELETE FROM Students removes every row. The WHERE line picks out only the rows you mean.

Make this stick

Signing in gives access to all PrepWise features.

PrepWise is a trading name of A3M Quality Solutions Limited, registered in England and Wales, company number 14959172. Registered office: 202 Stroud Road, Gloucester, GL1 5LA. ICO registration ZC267069.