Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
242 views

SQL Reference For OCR A Level Computer Science (H446)

The document provides an overview of SQL commands and concepts that students will need to understand for their OCR A Level Computer Science exam. It lists common SQL commands like SELECT, FROM, WHERE, and JOIN and provides examples of how each command is used. It also describes operators and wildcards that can be used to refine searches, as well as how to sort query results. Students are directed to online tutorials at sqlzoo.net and w3schools.com for interactive practice with SQL queries.

Uploaded by

Phoebe Cooler
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
242 views

SQL Reference For OCR A Level Computer Science (H446)

The document provides an overview of SQL commands and concepts that students will need to understand for their OCR A Level Computer Science exam. It lists common SQL commands like SELECT, FROM, WHERE, and JOIN and provides examples of how each command is used. It also describes operators and wildcards that can be used to refine searches, as well as how to sort query results. Students are directed to online tutorials at sqlzoo.net and w3schools.com for interactive practice with SQL queries.

Uploaded by

Phoebe Cooler
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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/

Command Explanation Code

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

Where The condition

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'​)

Like Like is used to create a “template” SELECT​ ​name​ ​FROM​ customer


for search criteria. WHERE​ ​name​ ​LIKE​ ​"St%"

In this example, the “st%” will find


all of the names that begin with st
and end with any other letter or
number.

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.

SELECT​ ​name​ ​FROM​ customer


WHERE​ ​name​ ​LIKE​ ​"St%"​ O
​ R ​Address =
"Oldham"

Delete Delete is used to delete an existing Delete​ ​From​ customer


record or set of records from a Where name​ = ​"Smith"
table.

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'​)

Drop The drop command is used to Drop​ ​Table​ customer


delete an existing table from the
database. Take care once deleted
it can't be undone and all of the
associated data will be lost.

Join The join command is used to SELECT Orders, Customers,


combine 2 or more rows from OrderDate
tables based on a linking field FROM Orders
JOIN Customers ON
Orders.CustomerID=Customers.Custom
erID;

Taken from W3Schools

Wildcards %​​ - Meaning zero or more SELECT​ * ​FROM​ customer


characters WHERE​ ​name​ ​LIKE​ ​"St%"

* ​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

Example question from


OCR exam builder

You might also like