Part 1 - SELECT Statement
Part 1 - SELECT Statement
❑ Syntax:
SELECT Column1, Column2, …
FROM Table_Name;
<Example>
SELECT LastName
FROM CUSTOMER;
<Example>
SELECT CustomerID,
LastName,
FirstName
FROM CUSTOMER;
This statement returns the list of customers’ Ids, last names, and
first names.
SELECT more than one column
<Example>
SELECT CustomerID,
LastName,
FirstName
FROM CUSTOMER;
SELECT all the columns available in the table
Syntax:
SELECT *
FROM Table_Name;
<Example>
SELECT * FROM CUSTOMER;
❑ Syntax:
SELECT DISTINCT Column1, Column2, …
FROM Table_Name;
SELECT DISTINCT
❑ Syntax:
SELECT DISTINCT Column1, Column2, …
FROM Table_Name;
<Example>
SELECT DISTINCT City
FROM CUSTOMER;
SELECT DISTINCT
SELECT City SELECT DISTINCT City
FROM CUSTOMER; FROM CUSTOMER;
Practice Questions
1. Find the cost and the price of each item.
2. Find the unique item description(s) in the ITEM table
3. Find the email addresses, last name, and first name of each
employee.
4. Find the email addresses of all vendors of the store.
5. Find the CustomerID and EmployeeID in the SALE table.
6. Find the list of the dates in which the store has (at least) a
sale.
QnA!