0% found this document useful (0 votes)
61 views1 page

SQL Queries for WorksOn Database

This document provides the schema for a WorksOn database including tables for employees, projects, departments, and works on records. It then lists 12 questions asking to write SQL queries to retrieve specific data from the database based on conditions. The questions involve filtering on budget amounts, hours worked, responsibilities, titles, salaries, departments, and ordering results.

Uploaded by

bayush
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views1 page

SQL Queries for WorksOn Database

This document provides the schema for a WorksOn database including tables for employees, projects, departments, and works on records. It then lists 12 questions asking to write SQL queries to retrieve specific data from the database based on conditions. The questions involve filtering on budget amounts, hours worked, responsibilities, titles, salaries, departments, and ordering results.

Uploaded by

bayush
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1) Create the following table and as it is

WorksOn Database:

emp (eno, ename, bdate, title, salary, dno)


proj (pno, pname, budget, dno)
dept (dno, dname, mgreno)
workson (eno, pno, resp, hours)

2) Questions:
3) Write an SQL query that returns the project number and name for projects with a
budget greater than $100,000.

4) Write an SQL query that returns all works on records where hours worked is less than
10 and the responsibility is 'Manager'.

5) Write an SQL query that returns the employees (number and name only) who have a
title of 'EE' or 'SA' and make more than $35,000.

6) Write an SQL query that returns the employees (name only) in department 'D1'
ordered by decreasing salary.

7) Write an SQL query that returns the departments (all fields) ordered by ascending
department name.

8) Write an SQL query that returns the employee name, department name, and employee
title.

9) Write an SQL query that returns the project name, hours worked, and project number
for all works on records where hours > 10.

10) Write an SQL query that returns the project name, department name, and budget for
all projects with a budget < $50,000.

11) Write an SQL query that returns the employee numbers and salaries of all employees in
the 'Consulting' department ordered by descending salary.

12) Write an SQL query that returns the employee name, project name, employee title,
and hours for all works on records.

You might also like