SQL Reference For OCR A Level Computer Science (H446)
SQL Reference For OCR A Level Computer Science (H446)
During the exam, you will be expected to interpret and use SQL to create, enter and extract data from a
database. Some great online and interactive tutorials to revise this topic. I would suggest https://sqlzoo.net/
and also https://www.w3schools.com/sql/
Select Select the fields which will be SELECT name, dob, address
displayed in the result. FROM customer
WHERE name = "Smith"
From Identifies the tables where the data
is stored
Nested Select It is possible to “nest” the select SELECT name FROM world
(Taken from SQLzoo) statement. In this example, the WHERE population >
second select statement is used to (SELECT population FROM world
obtain the population. WHERE name='Romania')
AND / OR And / Or can be used in the same SELECT name FROM customer
way as computational logic. They WHERE name LIKE "St%" A
ND Address
are used to create more complex = "Oldham"
WHERE expressions.
Insert Insert will add a new record into INSERT INTO Customers (Name, Dob,
the given table, notice the fields
and also the VALUES are added. Address)
VALUES ('Minnie Mouse',
'12/11/89', '123 Any Road')
* any fields
Order By Allows the results of the query to Select name, address from Customer
be sorted into a specific order. Where name LIKE "st%"
Order BY Surname