Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
101 views

Data Base and Management System Lab

The document is a lab journal that outlines 15 tasks related to querying tables in a database management system lab. The tasks involve writing SQL queries to retrieve, combine, filter, and join data from tables like EMP, DEPT, and JOB_GRADES. The queries are designed to select, filter, sort, and label columns from the tables based on various conditions.

Uploaded by

Arsalan Ishtiaq
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views

Data Base and Management System Lab

The document is a lab journal that outlines 15 tasks related to querying tables in a database management system lab. The tasks involve writing SQL queries to retrieve, combine, filter, and join data from tables like EMP, DEPT, and JOB_GRADES. The queries are designed to select, filter, sort, and label columns from the tables based on various conditions.

Uploaded by

Arsalan Ishtiaq
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Data Base and Management System Lab

CSL-220
 

Lab journal 6
 

Student’s Name: Arsalan Ishtiaq


Enrolment number(s): 01-134182-013
Class: BS (CS) – 4B
 
 
 
 
 

Department of Computer Sciences


BAHRIA UNIVERSITY, ISLAMABAD
Lab #6
LAB TASKS

1. Write a query to retrieve ename, length of enames, loc,deptno and sal by join table EMP
with table DEPT where deptno is 30 and sal is greater than 800. Sort the sal in descending
order.

2 Write a query to combine all rows of table EMP and table DEPT. Sort the columns in ascending
order by employee names.

3 Write a query for table EMP and DEPT to retrieve enames ,sal, job, deptno, loc where length of
job is greater than length of loc.
4 Write a query to join table EMP with itself wheremgr exists for any employee.

5 Create a query that displays ename, deptno, and all enames of those employees who
work in the same department as a given employee. Give each column an appropriate Label.

6 Create a query that displays enames, deptno, and hiredates of all employees hired after
employee MARTIN.
7 Create a query that displays enames, deptno, and hiredates for all employees who were
hired before their managers, along with their manager’s names and hiredates. Give the
columns with appropriate labels.

8 Write a query to display the name, department number, and department name for all
employees.

9 Create a unique listing of all jobs that are in department 80. Include the location of the
department in the output
10 Write a query to display the name, job, department number, and department name

11 Display the employee name and employee number along with their manager’s name
and manager number. Label the columns Employee, Emp#, Manager, and Mgr#, respectively.
12 Display all employees including King, who has no manager.

Note : As all employees have manager so no row is selected.

13 Create a query to display the name and hire date of any employee hired after employee
Davies.
14 Display the names and hire dates for all employees who were hired before their
managers, along with their manager’s names and hire dates
15 Show the structure of the JOB_GRADES table. Create a query that displays the name,
job, department name, salary, and grade for all employees.

You might also like