Computer-Science-A-level-Ocr
-
3-3-networks8 主题
-
3-2-databases7 主题
-
3-1-compression-encryption-and-hashing4 主题
-
2-5-object-oriented-languages7 主题
-
2-4-types-of-programming-language4 主题
-
2-3-software-development5 主题
-
2-2-applications-generation6 主题
-
2-1-systems-software8 主题
-
1-3-input-output-and-storage2 主题
-
1-2-types-of-processor3 主题
-
1-1-structure-and-function-of-the-processor1 主题
-
structuring-your-responses3 主题
-
the-exam-papers2 主题
-
8-2-algorithms-for-the-main-data-structures4 主题
-
8-1-algorithms10 主题
-
7-2-computational-methods11 主题
-
7-1-programming-techniques14 主题
-
capturing-selecting-managing-and-exchanging-data
-
entity-relationship-diagrams
-
data-normalisation
-
relational-databases
-
hashing
-
symmetric-vs-asymmetric-encryption
-
run-length-encoding-and-dictionary-coding
-
lossy-and-lossless-compression
-
polymorphism-oop
-
encapsulation-oop
-
inheritance-oop
-
attributes-oop
-
methods-oop
-
objects-oop
-
capturing-selecting-managing-and-exchanging-data
-
6-5-thinking-concurrently2 主题
-
6-4-thinking-logically2 主题
-
6-3-thinking-procedurally3 主题
-
6-2-thinking-ahead1 主题
-
6-1-thinking-abstractly3 主题
-
5-2-moral-and-ethical-issues9 主题
-
5-1-computing-related-legislation4 主题
-
4-3-boolean-algebra5 主题
-
4-2-data-structures10 主题
-
4-1-data-types9 主题
-
3-4-web-technologies16 主题
-
environmental-effects
-
automated-decision-making
-
computers-in-the-workforce
-
layout-colour-paradigms-and-character-sets
-
piracy-and-offensive-communications
-
analysing-personal-information
-
monitoring-behaviour
-
censorship-and-the-internet
-
artificial-intelligence
-
the-regulation-of-investigatory-powers-act-2000
-
the-copyright-design-and-patents-act-1988
-
the-computer-misuse-act-1990
-
the-data-protection-act-1998
-
adder-circuits
-
flip-flop-circuits
-
simplifying-boolean-algebra
-
environmental-effects
sql
Selecting Data (Single Table)
What is SQL?
-
In A Level Computer Science, SQL (Structured Query Language) is a programming language used to interact with a DBMS.
-
The use of SQL allows a user to:
-
Select data (single table)
-
Select data (multiple tables)
-
Insert data
-
Delete records
-
Delete tables
-
Selecting data (single table) commands
|
Command |
Description |
Example |
|---|---|---|
|
SELECT |
Retrieves data from a database table |
SELECT * FROM users; SELECT name, age |
|
FROM |
Specifies the tables to retrieve data from |
SELECT name, age FROM users; |
|
WHERE |
Filters the data based on a specified condition |
SELECT * FROM users |
|
LIKE |
Filters the data based on a specific pattern |
SELECT * FROM users |
|
AND |
Combines multiple conditions in a WHERE clause |
SELECT * FROM users |
|
OR |
Retrieves data when at least one of the conditions is true |
SELECT * FROM users |
|
WILDCARDS |
‘*‘ and ‘%‘ symbols are used for searching and matching data |
SELECT * FROM users; SELECT * FROM users WHERE name LIKE ‘J%’; |
Examples
-
Select all the fields from the Customers table
Command:

Output:
|
ID |
Name |
Age |
City |
Country |
|---|---|---|---|---|
|
1 |
John Doe |
30 |
New York |
USA |
|
2 |
Jane Doe |
25 |
London |
UK |
|
3 |
Peter Lee |
40 |
Paris |
France |
-
Select the ID, name & age of customers who are older than 25
Command:

Output:
|
ID |
Name |
Age |
|---|---|---|
|
1 |
John Doe |
30 |
|
3 |
Peter Lee |
40 |
-
Select the name and country of customers who are from a country that begins with ‘U’
Command:

Output:
|
Name |
Country |
|---|---|
|
John Doe |
USA |
|
Jane Doe |
UK |
-
Select all fields of customers who are from ‘London’ or ‘Paris’
Command:

Output:
|
ID |
Name |
Age |
City |
Country |
|---|---|---|---|---|
|
2 |
Jane Doe |
25 |
London |
UK |
|
3 |
Peter Lee |
40 |
Paris |
France |
Worked Example
Customers’ details are stored in the flat file database table Customer. An extract of the table is shown below

Write the S
Responses