Question

write the following queris in sql :

a) Using nested query , retreive the sependent names of male employees whose salary > 30000

b ) list the female employee, who are not managers

EMPLOYEE Fname MinitLname John Franklin T Wong 333445555 1955-12-08 638 Voss, Houston, TX M 4 Ssn Sex Salary Super sen Dno B Smith 123456789 1965 01-09 731 Fondren, Houston, TX M 30000 13334455 AliciaZelaya 999987777 1968-01-19 3321 Castle, Spring, TXF Jennifer S Wallace 987654321 1941-06-20 291 Berry, Bellaire, TX Ramesh K Narayan 666884444 1962-09-15 975 Fire Oak, Humble, TX M 380 Joyce A Engish 453453453 1972-07-31 5631 Rice, Houston, TXF 25000 Ahmad Jabbar 9879879871969-03-29 980 Dallas, Houston, TX M 25000 Jamcs EBorg 888665555 1937-11-10 450 Stone, Houston, TX M55000 4300 65555 4 38000 333445555 987654321 4 DEPARTMENT DEPT LOCATIONS Mgr.ssn 333445555 987654321 888665555 Mgr start date 1988-05-22 1995-01-01 5 5 WORKS ON PROJECT Pno Hours 132.5 7.5 3 40.0 Pnumber PlocalionDnum Bellaire 2 Sugarland 5 Pname 123456789 123456789 ProductY 68684444 3 0.0 462453453 453453453 333445555 333445555 3 333445555 333445555 2010.0 999887777 30 30.0 20.0- Computurication40 Stafford Reorganization 20 Houston Newbenefits 2 20.0 2 10.0 30 Stafford 310.0 10 10.0DEPENDENT Esan Dependent aa SesBdatoRohiterati 333445555 Alice 333445555 Theodone 333445555 Joy F 1986-04-05 Daughter M 1983-10-25 Son F1958-05-03 Spouse M 194202-28 Spouse 99987772 10 10.0 10 35.0 987987987 98798798730 987654321 987654321 888665555 987854321 Abner .| M | 1988-01-04 | Son 30 20.0 20 15.0 20 NULL 123456789 Michael 123456789 Alice 123456789 Elizabeth F 1988-12-30Daughter F 1967-05-05 Spouse Scanned by CamScanner

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The queries are given below.

********PLEASE NOTE: **********
SINCE CHEGG DOES NOT ALLOW SOME WORDS IN THE ANSWER, THE COLUMN NAME REPRESENTING GENDER IS WRITTEN SE.
X IS MISSING IN THE END (SE = 'M' AND SE = 'F' IN THE QUERIES). PLEASE CORRECT THE SPELLING BY ADDING AN X AT THE END.
CORRECT THE SPELLING IN BOTH THE QUERIES.


a) Using nested query , retreive the dependent names of male employees whose salary > 30000

SELECT Essn, Dependent_Name
FROM DEPENDENT
WHERE Essn IN (SELECT Ssn FROM EMPLOYEE WHERE SE = 'M' AND SALARY > 30000)


b ) list the female employee, who are not managers
SELECT Ssn, Fname, Lname
FROM EMPLOYEE
WHERE SE = 'F' AND Ssn NOT in (SELECT Mgr_ssn FROM DEPARTMENT)

Add a comment
Know the answer?
Add Answer to:
write the following queris in sql : a) Using nested query , retreive the sependent names...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use the tables in the next page to answer the following questions in SQL. 1. Print...

    Use the tables in the next page to answer the following questions in SQL. 1. Print the names of employees who work in a project located in Houston. 2. Print the names of employees with no dependents. 3. Print the names of employees who are managers. 4. Print the names of employees who have more than one wife. 5. Print the names of employees who work in all the projects. EMPLOYEE Frame John Franklin Minit B T S K A...

  • (SELECT pnumber FROM project, department, employee WHERE dnum=dnumber AND mgr_ssn=ssn AND lname='Smith') UNION (SELECT pnumber FROM...

    (SELECT pnumber FROM project, department, employee WHERE dnum=dnumber AND mgr_ssn=ssn AND lname='Smith') UNION (SELECT pnumber FROM project, works_on, employee WHERE pnumber=pno AND essn=ssnAND lname='Smith') Can you draw the relation step by step , how to solve it ?! Figure 5.6 One possible database state for the COMPANY relational database schema. EMPLOYEE Sex Salary Super ssn Dno B Smith 123456789 1965-01-09 731 Fondren, Houston, TX M 30000 3334455555 Ssn Fname Minit Lname John Franklin TWong 333445555 1955-12-08 638 Voss, Houston, TXM40000...

  • Search all employee who work total on all project less than 40 hrs from works_on table....

    Search all employee who work total on all project less than 40 hrs from works_on table. Please give me a query for this. Figure 5.6 One possible database state for the COMPANY relational database schema. EMPLOYEE Fname Minit Lname Sex Salary Super ssn Dno B Smith 123456789 1965-01-09 731 Fondren, Houston, TX M 30000 333445555 5 FranklinT Wong 333445555 1955-12-08 638 Voss, Houston, TX M 40000 888665555 5 JZelaya 999887777 1968-01-19 3321 Castle, Spring, TX F 25000 9876543214 JenniferSWallace 9876543211941-06-20...

  • Please provide the relation algebra, the oracle SQL code and the output tuples for the following (Answer #6 only the BONUS question). I have the others actually I have the BONUS, but I want to compar...

    Please provide the relation algebra, the oracle SQL code and the output tuples for the following (Answer #6 only the BONUS question). I have the others actually I have the BONUS, but I want to compare with your solution to make sure I did it correctly. Thank you very much! LAB exercises 2 Write the Oracle DML query codes for the following questions and take the screen shot of the output. 1. Retrieve the name and address of all employees...

  • Book: Fundamental of database systems Chapter 5 exercise 5.9 Figure 3-6 here provides examples on how...

    Book: Fundamental of database systems Chapter 5 exercise 5.9 Figure 3-6 here provides examples on how to answer this question: Photos - 20190906_111020[3691].jpg -ox See all photos + Add to Edit & Create Share : Q u ♡ 2 # d. A view that has the project name, controm of employees, and total hours worked per week on the project for each project with more than one employee working on it. 5.9. Consider the following view, DEPT SUMMARY, defined on...

  • ules for submission: 1. All problems must be solved using SQL code. The SQL code and...

    ules for submission: 1. All problems must be solved using SQL code. The SQL code and the output of your query should be cut and pasted into your MS Word file. a. Output Tables must be screenshot from DBMS b. Do not create a MS Word (or other application) table and paste the results into it. c. With the exception of Problems 4, 5 and 6, all output should be the result of a single step. Do not paste outputs...

  • I need help with the following SQL query for a company database (script given below). The...

    I need help with the following SQL query for a company database (script given below). The name of the Department. The number of employees working in that department. The number of different projects controlled by this department. The name of the project controlled by this department that has the maximum number of employees of the company working on it. The number of the above project. The cumulative sum of the number of employees of the company working on the projects...

  • Query 1: Retrieve names of all the projects as well as First and Last name of...

    Query 1: Retrieve names of all the projects as well as First and Last name of managers if they are working on any of these projects. Database: //STEP #1: CREATE TABLE employee ( fname varchar(15) not null, minit varchar(1), lname varchar(15) not null, ssn char(9), bdate date, address varchar(50), sex char, salary decimal(10,2), Super_ssn char(9), dno char(4), primary key (ssn)); CREATE TABLE department ( dname varchar(25) not null, dnumber char(4), Mgr_ssn char(9) not null, Mgr_start_date date, primary key (dnumber)); CREATE...

  • Query #2:       List the name of the project and total number of hours worked on by...

    Query #2:       List the name of the project and total number of hours worked on by all the employees on this project, also report the number of employees working on each project. Database: //STEP #1: CREATE TABLE employee ( fname varchar(15) not null, minit varchar(1), lname varchar(15) not null, ssn char(9), bdate date, address varchar(50), sex char, salary decimal(10,2), Super_ssn char(9), dno char(4), primary key (ssn)); CREATE TABLE department ( dname varchar(25) not null, dnumber char(4), Mgr_ssn char(9) not null,...

  • New to DB's Please help! You are designing and creating a database named COMPANY for an HR (Human Resource) Dept of...

    New to DB's Please help! You are designing and creating a database named COMPANY for an HR (Human Resource) Dept of a Software Consulting Company to manage their employees and their assigned work (projects) in the company First Step to Design and Create a Database is Creating an E-R Diagram by Identifying Entities, Attributes and Relationships between any two Entities to Create a Company Database Scheme. 1. Create an E-R Diagram for the Company database from the raw data files...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT