Download presentation
Presentation is loading. Please wait.
1
Query Methods Where Clauses Start …
2
All – most - some ... ALL : Define the term SQL
MOST : Describe the syntax for using WHERE clauses SOME : Explain how to use operators with WHERE clauses Next …
3
Click to explore more about the WHERE clauses …
What is a Database? SQL Statements AND & OR Thought board What is SQL? WHERE Clauses
4
What is a Database ..? A database is just a collection of data A simple database could be a computing text book Next …
5
What is a Database ..? Data about each topic is stored in the book The data is organised into chapters You can search for a topic using the content and index pages Back … Next …
6
What is a Database ..? Organisations have data that they need to store, collate and analyse 30 years ago this data would have been stored in a filing cabinet Back … Next …
7
What is a Database ..? Modern organisations use computer systems to store, collate and analyse data These systems are called Databases Back … Explore …
8
What is SQL ..? SQL (Structured Query Language) is used to search through and manage databases SQL is written as statements that are executed by the database Next …
9
What is SQL ..? SQL statements can be used to perform the following tasks … Execute queries against a database Retrieve data from a database Insert records in a database Update records in a database Delete records from a database Back … Explore …
10
Simple SQL Statements …
We use SQL Statements to manage large databases SQL statements can be used to Select Data, Update Data and Delete Data Next …
11
Simple SQL Statements …
Think about this SQL Statement … SELECT column_name,column_name FROM table_name; What do you think this SQL statement will do? Back … Explore …
12
Where Clauses … The WHERE clause is used to filter records in a Query It extracts (or selects) only those records that fulfil a specified criteria Next …
13
Can you think what this SQL statement might look like?
Where Clauses … You could use a WHERE clause to search for everyone who lives in Leicester Can you think what this SQL statement might look like? Back … Next …
14
Where Clauses … The syntax for a WHERE clause is … SELECT column_name,column_name FROM table_name WHERE column_name operator value; Back … Next …
15
What do you think is the purpose of this SQL statement?
Where Clauses … Think about this SQL statement … SELECT * FROM Customers WHERE Country=‘Scotland'; What do you think is the purpose of this SQL statement? Back … Next …
16
Where Clauses … SELECT * FROM Customers WHERE Country=‘Scotland'; This SQL statement selects all the customers from the country “Scotland", in the Customers table Back … Explore …
17
AND & OR … The AND & OR operators are used to filter records based on more than one WHERE condition For example … Male AND Brown Hair Male OR Brown Hair Next …
18
AND & OR … The AND operator displays a record if both the first condition AND the second condition are true The OR operator displays a record if either the first condition OR the second condition is true Back … Next …
19
What do you think this SQL statement does?
AND & OR … Think about this SQL statement … SELECT * FROM Customers WHERE Country=‘UK' AND City=‘Birmingham'; What do you think this SQL statement does? Back … Next …
20
AND & OR … Think about this SQL statement … SELECT * FROM Customers WHERE Country=‘UK' AND City=‘Birmingham'; This statement selects all customers from the country “UK" AND the city “Birmingham", in the Customers table Back … Next …
21
What do you think this SQL statement does?
AND & OR … Think about this SQL statement … SELECT * FROM Customers WHERE City=‘Birmingham' OR City=‘Glasgow'; What do you think this SQL statement does? Back … Next …
22
AND & OR … Think about this SQL statement … SELECT * FROM Customers WHERE City=‘Birmingham' OR City=‘Glasgow'; This SQL statement elects all customers from the city “Birmingham" OR “Glasgow", in the Customers table Back … Next …
23
AND & OR … You can combine AND and OR within one SQL statement Think about this SQL statement … SELECT * FROM Customers WHERE Country=‘Scotland' AND (City=‘Glasgow' OR City=‘Aberdeen'); Back … Next …
24
AND & OR … Think about this SQL statement … SELECT * FROM Customers WHERE Country=‘Scotland' AND (City=‘Glasgow' OR City=‘Aberdeen'); This SQL statement selects all customers from the country “Scotland" AND the city must be equal to “Glasgow" OR “Aberdeen" Back … Explore …
25
Thought Board … SELECT * FROM Customers WHERE City=‘Birmingham' OR City=‘Glasgow'; SELECT column_name,column_name FROM table_name; SELECT * FROM Customers WHERE Country=‘Scotland'; Explore …
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.