SELECT Query
This is the main query that is needed for the OCR GCSE Specification in the exam. This is the query used to retrieve data stored in a database.
There are many other SQL queries but it is unlikely that you will be test on them.
Examples Queries
SELECT Queries with Wildcard
SELECT * FROM Customers;
This would select all the columns from the customer table.
SELECT Queries with where
SELECT Name, Telephone FROM Customers WHERE OrderID = 521;
This would select the Name and Telephone Columns from the Customers table for any record where the OrderId = 521;
SELECT Queries with Logical Operators
SELECT Name, Address FROM Customers WHERE Age > 55;
This would return the name and address of all cutomers who are over 55 years old
SQL Practice
The best way to learn SQL is to just practice the queries. Have a go at these sites and learn some SQL!
SQL Zoo
Great for practice activities
w3Schools SQL
Another great site for practice
https://www.w3schools.com/sql/
SQL Island Game
Progress through this game by using SQL
You can use Python to read and write SQLite databases on your computer, which is a great way to store data when you move beyond simple text files in your GCSE Coding projects. Check out these videos on how it works:
Creating SQLite databases and tables
Inserting Data into Databases
Retrieving data from databases
Updating database tables
Deleting items from databases