You are on page 1of 1

SQL Assignment

Table: Customers
FirstName

LastName

Email

DOB

Phone

John

Smith

John.Smith@yahoo.com

2/4/1968

626 222-2222

Steven

Goldfish

goldfish@fishhere.net

4/4/1974

323 455-4545

Paula

Brown

pb@herowndomain.org

5/24/1978

416 323-3232

James

Smith

jim@supergig.co.uk

10/20/1980

416 323-8888

SQL Commands:
1. Apply SELECT statement arbitrarily to select data from the above database table.
2. Apply SQL DISTINCT clause with the SELECT statement to return Last name and Phone
numbers from the above database table.
3. Apply SQL WHERE clause to select customers conditionally (for example customers
having last name “Smith”.
4. Repeat item 3 to select customers who are younger than 40 years old.
5. Add the following individual to the above table using an SQL statement:
Peter Hunt, peter.hunt@tgmail.com, 1/1/1974, 626-888-7777.
6. Modify the Steven Goldfish’s date of birth to 5/10/1974.
7. Remove James Smith from the above database table.
8. Reorder the above database table based on the customers’ age from youngest to
oldest.
9. Apply SQL AND clause to select James Smith.
10. Apply SQL OR clause to select all customers having First Name “James” or ‘Paula”.