17-Structured-Query-Language-SQL-SAMPLE-A-Level
17-Structured-Query-Language-SQL-SAMPLE-A-Level
Free Sample
THANK YOU FOR DOWNLOADING THIS FREE SAMPLE RESOURCE!
Here, you’ll find a snippet of the module, which you can use to gauge the quality
of our offering, but will also find super useful in the classroom.
teachcomputerscience.com
Teach Computer Science
A-Level
Structured Query
Language (SQL)
teachcomputerscience.com
1.
Revision notes
teachcomputerscience.com
Introduction
SQL is a declarative programming language used to access and
manage databases. The SQL statements use simple language and are
easy to understand and remember.
Let us work with a database that is responsible for maintaining the
details of students, teachers, courses and prints grades of students.
The entity relationship diagram along with the entity descriptions is
given. We will use this database as an example for learning queries.
Teacher
StudentI
StudentName Major DateOfBirth
D
S291 David Watson Science 21/03/1998
S157 Helen Williams Economics 30/04/1999
S918 Paul Ingram Architecture 14/05/1998
S241 Rosemarie Collin Science 19/07/1999
S511 John Rayner Business 12/11/1998
S256 Alan Cross Economics 12/08/1999
S791 Samuel Smith Architecture 19/10/1999
teachcomputerscience.com
The syntax for a SELECT query in SQL is:
SELECT field_names FROM table_name WHERE condition ORDER BY
field_name
A * symbol is used for field_names if all columns are to be displayed.
The query to print the complete table is:
SELECT * FROM Student
The query to print StudentName and StudentID of students born in
the year 1998 in alphabetical order is:
SELECT StudentID, StudentName FROM Student WHERE DateOfBirth
BETWEEN #01/01/1998# AND #31/12/1998# ORDER BY StudentName
The ORDER BY clause by default orders in ascending order. The result
for this query is:
StudentI
StudentName
D
S291 David Watson
S511 John Rayner
S918 Paul Ingram
teachcomputerscience.com
2.
Activities
teachcomputerscience.com
Activity-1
Duration: 20 minutes
SellingPric Quantit
PrdID PrdTitle LaunchDate
e (£) y
A. What query was used to enter the record with PrdID=113 into this
table?
teachcomputerscience.com
Activity-1
Duration: 20 minutes
SellingPric Quantit
PrdID PrdTitle LaunchDate
e (£) y
A. What query was used to enter the record with PrdID=113 into this
table?
teachcomputerscience.com
Flashcards
What operator
represents not equal to != or <>
in SQL?
teachcomputerscience.com
Glossary
A data type used in programming language
Boolean
to represent two values: TRUE or FALSE.
teachcomputerscience.com
Quiz
1. What is the function of != operator?
A. Less than
B. Greater than
C. Equal to
D. Not equal to
teachcomputerscience.com
Teach Computer Science
http://creativecommons.org/licenses/by-nc/4.0/
Thank you!
teachcomputerscience.com
Teach Computer Science
We hope it has been useful for you in the classroom and that your
students enjoy the activities.
For more teaching resources like this, don’t forget to come back
and download the new material we add every week!
teachcomputerscience.com