Knowledge organisersAdditional Programming Techniques
SQL commands:SELECT, FROM, WHERE
SQL (Structured Query Language) is used to search for, manage, and retrieve data from a database. The three key SQL commands you need to know are SELECT (which fields to return), FROM (which table to search), and WHERE (which conditions to apply). You can select specific fields, multiple fields, or all fields using the wildcard *.
WHERE YearGroup = 11.SELECT * returns ALL fields from the table.WHERE DroneType = "Octocopter" AND Mileage > 50000.= for comparison in SQL (not ==, although == is accepted in some exam mark schemes).SELECT * or list all field names separated by commas.WHERE SensorType = "Door". Numeric values don't need quotes: WHERE Mileage > 50000.WHERE SensorType = "Door" AND Length > 20.-- Get all unsold cars
SELECT Model
FROM Cars
WHERE Sold = FALSE
-- Get multiple fields with conditions
SELECT Model, Manufacturer, Price
FROM Cars
WHERE Sold = TRUE AND Price > 4000
-- Get all fields for Ford cars
SELECT *
FROM Cars
WHERE Manufacturer = 'Ford'