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

sQL Query Practice I The following query statements are based on Company databas

ID: 3734587 • Letter: S

Question

sQL Query Practice I The following query statements are based on Company database in class note EMPLOYER DEPT LOCATIONS WORKS ON DEPENDENT NAM RELATIONSHIP Query 0: List the last name of male employees. Query 0-1: List the first name, middle name and last name of employees who born on December 8, 1995. Query 0-2: List the first name and last name of employees who earn $50,000 minimum salary (more than $50,000). Query 1: List the birthdate and address of the employee whose name is Tom G Brand'. Query 1-1: List the location of department no 8. Query 1-2: List the name and location of projects which department no 5 manages. Query 1-3: List the name of spouse of all employees. Query 2: Retrieve social security numbers for all employees. Query 2-1: List all different last names of employees. Query 3: List the social security numbers of all employees who work on project number 1, 2, or 3. Query 3-1: List the name and salary of employees who work for department number 4, 5, or 6. Query 4: List the names of all employees who do not have supervisors. Query 5: List all employees whose address is in Atlanta, GA. Query 6: List all employees who were born during the 1960s. (use LIKE) Query 6-1: List all employees who were born during the 1960s. (use BETWEEN AND) Query 6-2: List employees who first name is between 'Apple' and 'Bee.

Explanation / Answer

Query 0 : select LNAME from EMPLOYEE where SEX = 'MALE';


Query 0 - 1 : select FNAME,MNAME,LNAME from EMPLOYEE where BDATE = '1995-12-08';


Query 0 - 2 : select FNAME,LNAME from EMPLOYEE where SALARY > 50000;


Query 1 : select BDATE,ADDRESS from EMPLOYEE where FNAME = 'Tom' and MNAME = 'G' and LNAME = 'Brand';


Query 1 - 1 : select DLOCATION from DEPT_LOCATIONS where DNUMBER = 8;


Query 1 - 2 : select PNAME,PLOCATION from PROJECT where DNUM = 5;

Query 2 : select SSN from EMPLOYEE;

Query 2 - 1 : select distinct LNAME from EMPLOYEE;

Query 3 : select EMPLOYEE.SSN from EMPLOYEE inner join PROJECT on EMPLOYEE.DNO = PROJECT.DNUM where PROJECT.PNUMBER = 1 or PROJECT.PNUMBER = 2 or PROJECT.PNUMBER = 3;

Query 3 - 1 : select EMPLOYEE.FNAME,EMPLOYEE.SALARY from EMPLOYEE inner join DEPARTMENT on EMPLOYEE.DNO = DEPARTMENT.DNUMBER where DEPARTMENT.DNUMBER = 4 or DEPARTMENT.DNUMBER = 5 or DEPARTMENT.DNUMBER = 6;