Day 3

Quiz

Use the FRIENDS table to answer the following questions.

LASTNAME        FIRSTNAME        AREACODE PHONE    ST ZIP
--------------- --------------- --------- -------- -- ------
BUNDY           AL                    100 555-1111 IL 22333
MEZA            AL                    200 555-2222 UK
MERRICK         BUD                   300 555-6666 CO 80212
MAST            JD                    381 555-6767 LA 23456
BULHER          FERRIS                345 555-3223 IL 23332
PERKINS         ALTON                 911 555-3116 CA 95633
BOSS            SIR                   204 555-2345 CT 95633
1: Write a query that returns everyone in the database whose last name begins with M.
A1:
SELECT * FROM FRIENDS WHERE LASTNAME LIKE 'M%';
2: Write a query that returns everyone who lives in Illinois with a first name of AL.
A2:
SELECT * FROM FRIENDS
WHERE STATE = 'IL'
AND FIRSTNAME = 'AL';
3: Given two tables (PART1 and PART2) containing columns named

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.