SQL Where PDF
SQL Where PDF
SQL Where PDF
WHERE
Clause
Practice
Problem
Solutions
Question
1:
SELECT
FirstName,
LastName
FROM
Person.Person
WHERE
FirstName
=
'Mark'
Question
2:
SELECT
TOP
100
*
FROM
Production.Product
WHERE
ListPrice
<>
0.00
Question
3:
SELECT
*
FROM
HumanResources.vEmployee
WHERE
LastName
<
'D'
Question
4:
SELECT
*
FROM
Person.StateProvince
WHERE
CountryRegionCode
=
'CA'
Question
5:
SELECT
FirstName
AS
"Customer
First
Name",
LastName
AS
"Customer
Last
Name"
FROM
Sales.vIndividualCustomer
WHERE
LastName
=
'Smith'
Question
6:
SELECT
*
FROM
Sales.vIndividualCustomer
WHERE
CountryRegionName
=
'Australia'
OR
(PhoneNumberType
=
'Cell'
AND
EmailPromotion
=
0)
Question
7:
SELECT
*
FROM
HumanResources.vEmployeeDepartment
WHERE
Department
IN
('Executive',
'Tool
Design',
'Engineering')
SELECT
*
FROM
HumanResources.vEmployeeDepartment
WHERE
Department
=
'Executive'
OR
Department
=
'Tool
Design'
OR
Department
=
'Engineering'
Question
8:
SELECT
*
FROM
HumanResources.vEmployeeDepartment
WHERE
StartDate
BETWEEN
'7/1/2000'
AND
'6/30/2002'
SELECT
*
FROM
HumanResources.vEmployeeDepartment
WHERE
StartDate
>=
'7/1/2000'
AND
StartDate
<=
'6/30/2002'
Question
9:
SELECT
*
FROM
Sales.vIndividualCustomer
WHERE
LastName
LIKE
'R%'
Question
10:
SELECT
*
FROM
Sales.vIndividualCustomer
WHERE
LastName
LIKE
'%r'
Question
11:
SELECT
*
FROM
Sales.vIndividualCustomer
WHERE
LastName
IN
('Lopez',
'Martin',
'Wood')
AND
FirstName
LIKE
'[C-‐L]%'
Question
12:
SELECT
*
FROM
Sales.SalesOrderHeader
WHERE
SalesPersonID
IS
NOT
NULL
Question
13:
SELECT
SalesPersonID,
TotalDue
FROM
Sales.SalesOrderHeader
WHERE
SalesPersonID
IS
NOT
NULL
AND
TotalDue
>
70000