Professional Documents
Culture Documents
Crew Information in A Fastfood Restaurant: EN o Lname Fname M I Statio N G Ende R Stat Us Bday Add Contact No
Crew Information in A Fastfood Restaurant: EN o Lname Fname M I Statio N G Ende R Stat Us Bday Add Contact No
AND
1. Display all fields where gender is equal to female and status is equal to married.
SELECT *
FROM emp_info
WHERE gender='F' AND status='M';
2. Display employee number, last name, first name station and gender of crew whose station is grill and
whose gender is male.
En L F Stati Gend
o nam nam on er
e e
E Reye Jaim Grill M
208 s e
E Estre Allan Grill M
204 lla
3. Display all fields where last name is Santos and Gender is female.
SELECT *
FROM emp_info
WHERE Lname='Santos' AND Gender='F';
4. Display all fields where address starts with F and Status is single.
SELECT *
FROM emp_info
WHERE Add like 'F*' AND Status='S';
6. Display all fields where address starts with F and contact number starts with 0919.
SELECT *
FROM emp_info
WHERE Add like 'F*' AND ContactNo like '0919*';
7. Display all fields where gender is female, status is single and contact number starts with 0919.
SELECT *
FROM emp_info
WHERE Gender='F' AND Status= 'S' AND ContactNo like '0919*';
OR
SELECT *
FROM emp_info
WHERE Station='Dining' OR Station='Counter';
SELECT *
FROM emp_info
WHERE Lname='Santos' OR Lname='Reyes';
3. Display all fields where contact number starts with 0917 or 0916.
SELECT *
FROM emp_info
WHERE ContactNo like '0917*' OR ContactNo like '0916*';
SELECT *
FROM emp_info
WHERE Station='Soda' OR Status= 'M';
5. Display all fields where last name starts with D or first name starts with E.
SELECT *
FROM emp_info
WHERE Lname like 'D*' OR Fname like 'E*';
SELECT *
FROM emp_info
WHERE Add like 'T*' OR Add like 'M*';
SELECT *
FROM emp_info
WHERE Station='Back-up' OR Station='Stockman';
NOT
SELECT *
FROM emp_info
WHERE NOT (Status= 'S');
2. Display all fields where Station is not counter and not dining.
SELECT *
FROM emp_info
WHERE (NOT (Station= 'Counter')) AND (NOT (Station='Dining'));
3. Display all fields where Address does not start with F and P.
SELECT *
FROM emp_info
WHERE NOT(Add like 'F*') AND NOT(Add like 'P*');
4. Display all fields where last name does not have the letter S in it.
SELECT *
FROM emp_info
WHERE NOT(Lname like '*S*');
5. Display all fields where last name does not contain S and Station is not dining or counter.
SELECT *
FROM emp_info
WHERE NOT(Lname like '*S*') AND NOT(Station='Dining' OR Station='Counter');
6. Display all fields where birth year is not from 1988 to 1990.
SELECT *
FROM emp_info
WHERE Not(Bday>=#1/1/88# AND Bday<=#12/31/90#);
7. Display all fields where Station is dining but address does not start with F.
SELECT *
FROM emp_info
WHERE Station='Dining' AND NOT(Add like 'F*');
COMBINATION
1. Display all fields where station is not Dining and Counter, Address does not start with F and Gender
is female.
SELECT *
FROM emp_info
WHERE (NOT (Station= 'Counter')) AND (NOT (Station='Dining')) AND (NOT(Add like 'F*')) AND
Gender='F' ;
2. Display all fields where last name is Santos or Reyes but address does not start with F.
SELECT *
FROM emp_info
WHERE (Lname='Santos' OR Lname='Reyes') AND (NOT(Add like 'F*'));
3. Display all fields where Station is Dining and Gender is Male but address does not start with F or
Station is Pantry but address does not start with P.
SELECT *
FROM emp_info
WHERE (Station='Dining' AND Gender='M' AND NOT(Add like'F*')) OR (Station='Pantry' AND NOT(Add
like 'P*'));
4. Display all fields where birth year is 1988 but address does not start with P or birth year is 1988 and
address start with F.
SELECT *
FROM emp_info
WHERE ((Bday>=#1/1/88#) AND (Bday<=#12/31/88#) AND NOT(Add like 'P*')) OR ((Bday>=#1/1/88#) AND
(Bday<=#12/31/88#) AND (Add like 'F*'));
5. Display all fields where Station is not Dining and birth year is 1990 and gender is male or Station is
not Dining and birth year is 1988 and gender is male.
SELECT *
FROM emp_info
WHERE (NOT(Station='Dining') AND (Bday>=#1/1/90# AND Bday<=#12/31/90#) AND Gender='M') OR
(NOT(Station='Dining') AND (Bday>=#1/1/88# AND Bday<=#12/31/88#) AND Gender='M');
6. Display all fields where Status is single and Gender is female and Station is counter or Status is single
and Gender is male and Station is dining and Address does not start with P.
SELECT *
FROM emp_info
WHERE (Status='S' AND Gender='F' AND Station='Counter') OR (Status='S' AND Gender='M' AND Station='Dining'
AND NOT(Add like 'P*'));
7. Display all fields where last name starts with S and Gender is male and Station is not fry or last
name starts with A and Gender is male.
SELECT *
FROM emp_info
WHERE (Lname like 'S*' AND Gender='M' AND NOT(Station='Fry')) OR (Lname like 'A*' AND Gender='M');
8. Display all fields where first name starts with J but address does not start with P or first name starts
with J and station is dining.
SELECT *
FROM emp_info
WHERE (Fname like 'J*' AND NOT(Add like 'P*')) OR (Fname like 'J*' AND Station='Dining');
9. Display all fields where Station is Grill and Gender is male or Station is Soda but address does not
start with F.
SELECT *
FROM emp_info
WHERE (Station='Grill' AND Gender='M') OR (Station='Soda' AND NOT(Add like 'F*'));