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

I need help with a few SQL database codes to return some resutls! The queries th

ID: 3606275 • Letter: I

Question

I need help with a few SQL database codes to return some resutls! The queries that I need to write are described below this and the tables I have are described below the questions.

--------------------

Now this is the difficult part for me, what would I need to input as the queries to get the results below?

*Find the ssn and last name of every employee whose ssn contains two consecutive 8's, and has a supervisor. Sort the results by ssn.

*For every employee who works for more than 20 hours on any project that is controlled by the research department: Find the ssn, project number, and number of hours. Sort the results by ssn.

*Write a query that consists of one block only.
For every employee who works less than 10 hours on any project that is controlled by the department he works for: Find the employee's lname, his department number, project number, the number of the department controlling it, and the number of hours he works on that project. Sort the results by lname.

*For every employee who works on any project that is located in Houston: Find the employees ssn and lname, and the names of his/her dependent(s) and their relationship(s) to the employee. Notice that there will be one row per qualyfing dependent. Sort the results by employee lname.

*Write a query that consists of one block only.
For every employee who works for a department that is different from his supervisor's department: Find his ssn, lname, department number; and his supervisor's ssn, lname, and department number. Sort the results by ssn.

-----------------

Tables

-

employee, department, dept_locations, project, works_on, dependent

-

Keys in order of tables

-

fname, lname, ssn, bdate, address, sex, super_ssn, dno

dnumber, dname, mgrssn, mgrstartdate

dnumber, dlocation

pname, pnumber, plocation, dnum

essn, pno, hours

essn, dependent_name, sex, bdate, relationship

Explanation / Answer

2 - select works_on.essn,works_on.pno,works_on.hours from works.on where works_on.hours >20 and works_on.pno = ((select works_on.pno from works_on join project where project.dnum = (select project.dnum from project join department where dname = 'Research')) orderby works_on.essn

4 - select employee.ssn,employee.lname,dependent.dependent_name,dependent.relationship from employee inner join dependent where employee.dno equals (select employee.dno from employee join project where project.plocation equals 'Houston') orderby employee.lname

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote