0% found this document useful (0 votes)
6 views3 pages

SP23 Bai 034

The document outlines a series of lab assignments for a Database Systems course at COMSATS University Islamabad, prepared by Muhammad Laraib Afridi. It includes SQL tasks for querying employee data, such as selecting specific fields, filtering records, and performing calculations. The assignments are structured into three labs, each containing multiple tasks focusing on different aspects of database querying and manipulation.

Uploaded by

Laraib Afridi
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)
6 views3 pages

SP23 Bai 034

The document outlines a series of lab assignments for a Database Systems course at COMSATS University Islamabad, prepared by Muhammad Laraib Afridi. It includes SQL tasks for querying employee data, such as selecting specific fields, filtering records, and performing calculations. The assignments are structured into three labs, each containing multiple tasks focusing on different aspects of database querying and manipulation.

Uploaded by

Laraib Afridi
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
You are on page 1/ 3

COMSATS UNIVERSITY ISLAMABAD

DATABASE SYSTEMS
LAB ASSIGNMENT NO 1

OCT 21, 2024

PREPARED BY :
MUHAMMAD LARAIB AFRIDI | SP23-BAI-
034
PREPARED TO :
Sir. Haseeb Ur Rehman
LAB 01
 LAB TASK 1
SELECT employee_id, last_name AS name, job_id, hire_date AS "Start Date"
FROM employees;
 LAB TASK 2
SELECT last_name || ' , ' || job_id AS "Employee And Title" FROM employees;
 LAB TASK 3
SELECT DISTINCT job_id FROM employees;
 LAB TASK 4
SELECT first_name||' '||last_name "Name" FROM employees;
 LAB TASK 5
SELECT first_name, salary, 12*salary "ANNUAL SALARY" FROM employees;
 LAB TASK 6
DESCRIBE departments;

LAB 02
 LAB TASK 1
SELECT last_name, department_id FROM employees WHERE employee_id =
176;
 LAB TASK 2
SELECT last_name, salary FROM employees WHERE salary NOT BETWEEN
5000 AND 12000;
 LAB TASK 3
SELECT last_name, job_id, hire_date FROM employees WHERE last_name
IN( 'Matos' , 'Taylor') ORDER BY hire_date ASC;
 LAB TASK 4
SELECT last_name, department_id FROM employees WHERE department_id
IN (20, 50) ORDER BY last_name ASC;
 LAB TASK 5
SELECT last_name, job_id FROM employees WHERE department_id IS NULL;
 LAB TASK 6
SELECT last_name, salary,commission_pct*salary AS Commission FROM
employees WHERE commission_pct IS NOT NULL ORDER BY 2
DESC ,commission_pct*salary DESC;
 LAB TASK 7
SELECT employee_id, last_name, salary, department_id FROM employees
WHERE manager_id ='&manager_id' ORDER BY &order_column;
 LAB TASK 8
SELECT last_name FROM employees WHERE last_name LIKE '%a%' AND
last_name LIKE '%e%';
 LAB TASK 9
SELECT last_name, job_id, salary FROM employees WHERE job_id IN
('SA_REP','ST_CLERK') AND salary NOT IN (2500,3500,7000);

LAB 03
 LAB TASK 1
SELECT employee_id, last_name, salary, ROUND(salary * 1.155) AS "New
Salary" FROM employees;
 LAB TASK 2
SELECT last_name, CEIL(MONTHS_BETWEEN(SYSDATE, hire_date)) AS
"MONTHS_WORKED" FROM employees ORDER BY MONTHS_WORKED;
 LAB TASK 3
SELECT last_name, NVL(TO_CHAR(commission_pct), 'No Commission') AS
"COMM" FROM employees;
 LAB TASK 4
SELECT INITCAP(last_name) AS "Last Name", LENGTH(last_name) AS
"Length" FROM employees WHERE last_name LIKE 'J%' OR last_name LIKE 'A
%' OR last_name LIKE 'M%' ORDER BY last_name;

You might also like