0% found this document useful (1 vote)
3K views1 page

SQL Join Assignment

The document outlines 11 tasks involving writing SQL queries to retrieve information from multiple database tables, including: 1. Displaying employee last names, department numbers and names. 2. Creating a unique listing of jobs in department 80 including location. 3. Displaying employee last names, department names, locations and cities for employees earning commissions. 4. Displaying employee last names and department names for employees with 'a' in their last name.

Uploaded by

hemanttgm
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (1 vote)
3K views1 page

SQL Join Assignment

The document outlines 11 tasks involving writing SQL queries to retrieve information from multiple database tables, including: 1. Displaying employee last names, department numbers and names. 2. Creating a unique listing of jobs in department 80 including location. 3. Displaying employee last names, department names, locations and cities for employees earning commissions. 4. Displaying employee last names and department names for employees with 'a' in their last name.

Uploaded by

hemanttgm
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 1

Emp (empno,empname,hire_date, mgr, job, salary, comm.

,deptno)

Dept(deptno, deptname, locno)

Location (locno, city)

Salgrade(grade, lowsal, hisal)

1. Write a query to display the last name, department number, and department name for all
employees.
2. Create a unique listing of all jobs that are in department 80. Include the location of the
department in the output.
3. Write a query to display the employee last name, department name, location ID, and city of all
employees who earn a commission.
4. Display the employee last name and department name for all employees who have an a
(lowercase) in their last names. Place your SQL statement in a text file named lab4_4.sql.
5. Write a query to display the last name, job, department number, and department name for all
employees who work in Toronto.
6. Display the employee last name and employee number along with their manager’s last name and
manager number. Label the columns Employee, Emp#, Manager, and Mgr#, respectively. Place
your SQL statement in a text file named lab4_6.sql.
7. Modify lab4_6.sql to display all employees including King, who has no manager. Order the
results by the employee number. place your SQL statement in a text file named lab4_7.sql. Run
the query in lab4_7.sql.

8. Create a query that displays employee last names, department numbers, and all the employees
who work in the same department as a given employee. Give each column an appropriate label.

9. Show the structure of the JOB_GRADES table. Create a query that displays the name, job,
department name, salary, and grade for all employees.

10. Create a query to display the name and hire date of any employee hired after employee Davies.

11. Display the names and hire dates for all employees who were hired before their managers, along
with their manager’s names and hire dates. Label the columns Employee, Emp Hired, Manager,
and Mgr Hired, respectively.

You might also like