Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Shouhong Wang, Hai Wang

1st Edition

1612330150, 978-1612330150

More Books

Students also viewed these Databases questions

Question

Understand how to design effective service guarantees.

Answered: 1 week ago

Question

Know when firms should not offer service guarantees.

Answered: 1 week ago