Save
...
mock
databases
SQL
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
emily d
Visit profile
Cards (25)
What does SQL stand for?
Structured Query Language
View source
What is the purpose of SQL?
To search
database
tables for specific data
View source
What do records and fields refer to in a database table?
Rows
and
columns
View source
Which keywords are the most important in SQL?
SELECT
and
FROM
View source
How do you write a query to retrieve data?
Use
SELECT
followed by field names and
FROM
View source
What does the SELECT keyword do?
Retrieves specified fields from a
database
View source
What does the FROM keyword specify?
The
table
from
which
to
retrieve
data
View source
What does the wildcard character '*' do in SQL?
Returns
all
fields
from a
table
View source
What is the purpose of the WHERE keyword?
To specify conditions for returned
records
View source
How would you filter hotels with a rating greater than 4.1?
SELECT
*
FROM
hotels
WHERE
hotelRating
> 4.1
View source
What do Boolean operators AND and OR do in SQL?
Make
searches
more
specific
View source
Write a SQL query to find hotels with an en-suite bathroom and price under £45.
SELECT
hotelName FROM hotels
WHERE
bathroom = "En-suite"
AND
priceInPounds
< 45
View source
What does the ORDER BY keyword do in SQL?
Sorts records in
ascending
or
descending
order
View source
How would you write a query to find hotels with more than 100 rooms, excluding Windy Hotel?
SELECT
hotelName
, priceInPounds FROM hotels
WHERE
rooms > 100
AND
hotelName
!=
"Windy Hotel"
View source
What is the result of the query SELECT hotelName FROM hotels WHERE rooms > 100 AND hotelName != "Windy Hotel"?
Returns
names
of
hotels
with >
100
rooms
View source
What is the structure of the viewings table?
customer
,
propertyNumber
,
time
View source
How do you join two tables in SQL?
Using the
WHERE
clause to match
fields
View source
Write a SQL query to find addresses and times of viewings with "Helen".
SELECT
properties
.address, viewings.time
FROM
properties, viewings
WHERE
viewings.propertyNumber = properties.propertyNumber AND
customer
= "Helen"
ORDER BY
time
ASC
View source
What is the result of the query SELECT properties.address, viewings.time FROM properties, viewings WHERE customer = "Helen" ORDER BY time ASC?
Returns
addresses
and
times
for
Helen's
viewings
View source
What is the structure of the properties table?
propertyNumber
, parking, address
View source
What does the INSERT INTO statement do?
Adds new
records
to a table
View source
What are the key components of a SQL query?
SELECT
: specifies fields to retrieve
FROM
: specifies the table to search
WHERE
: filters records based on conditions
ORDER BY
: sorts records in a specified order
View source
How do you filter records in SQL using multiple conditions?
Use
WHERE
to specify conditions
Combine conditions with
AND
or OR
Example: WHERE condition1 AND condition2
View source
What are the differences between the viewings and properties tables?
Viewings: contains
customer
,
propertyNumber
, time
Properties: contains propertyNumber,
parking
,
address
Viewings link to Properties via propertyNumber
View source
always write
SELECT
FROM
WHERE