Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

mysql create table friends (lastname varchar(15) not null, firstname varchar(15)

ID: 3784505 • Letter: M

Question

mysql

create table friends
(lastname varchar(15) not null,
firstname varchar(15) not null,
areacode numeric(9) null,
phone varchar(10) null,
st char(2) not null,
zip varchar(5) not null);

insert into friends values
('BUNDY', 'AL', '100', '555-1111', 'IL', '22333');

insert into friends values
('MEZA', 'AL', '200', '555-2222', 'UK', '');

insert into friends values
('MERRICK', 'BUD', '300', '555-6666', 'CO', '80212');

insert into friends values
('MAST', 'JD', '381', '555-6767', 'LA', '23456');

insert into friends values
('BULHER', 'FERRIS', '345', '555-3223', 'IL', '23332');

Using the friends table, write a query that returns the following: Using the friends table, write a query that returns the following: NAME PHONE MERRICK, BUD 300-555-6666 MAST, JD 381-555-6767 BULHER, FERRIS 345-555-3223

Explanation / Answer

1. SELECT lastname AS NAME, st FROM FRIENDS WHERE phone=555-1111;

2. SELECT firstname as NAME, areacode-phone AS PHONE FROM FRIENDS WHERE phone=555-6666 AND phone=555-6767 AND phone=555-3223;

if you like this answer, please give a thumbs up and if you have some doubt just ask in the comment section below. I will try to help. Cheers