Net Database SQL 10
Net Database SQL 10
Lesson Outcomes
All of you will be able to describe and recall
the syntax involved with a select command
All of you will use=
1. Select*
2. In
3. Between
4. Revise comparison operators
5. Revise boolean operators
. Most of you will be able to create commands
in order to interogate data within tables
Recap
SQL
Structured
Query
Language
The structure
SELECT FROM
WHERE
The structure
<Tablename(s
)>
<ColumnNam
e(s)>
<Tablename(s
)>
<ColumnNam
e(s)>
First example
Open the database document: Marksheet
SELECT Name FROM Marksheet WHERE
Assign1 > 50
What would you expect as a result?
First example
Name
Aisha
Katharine
Fiona
Gareth
Manjit
Ubaid
Gemma
Alex
Philip
Second example
Open the database document: Marksheet
SELECT Name, Average FROM Marksheet WHERE
Average > 0 AND Average < 65
Second example
Using = Select*
SELECT * FROM Marksheet WHERE Average > 70
Second example
Using = Select*
SELECT * FROM Marksheet WHERE Average > 70
Name
Assign1
Assign2
Assign3
Average
Fiona
100
87
72
86
Gareth
86
65
69
73
Philip
90
86
85
87
Second example
Using = IN
SELECT Name, Average WHERE IN (Aisha ,Jo , Mark ,
Shan) gives
IN Specifies multiple
values
Second example
Using = IN
SELECT Name, Average FROM Marksheet WHERE IN
(Aisha ,Jo , Mark , Shan) gives
IN Specifies multiple
Name
Averag
e
values
Aisha
Jo
Mark
58
45
13
Second example
Using = BETWEEN
SELECT * FROM Marksheet WHERE Average BETWEEN
60 AND 75
Second example
Using = BETWEEN
SELECT * FROM Marksheet WHERE Average BETWEEN
60 AND 75
Name
Assign1
Assign2
Assign3
Average
Katharine 75
76
48
70
Gareth
86
65
69
73
Manjit
66
64
68
66
Gemma
52
78
78
69
http://sqlzoo.n
et/