Dbms Paper Open Ended 1 02122021 090519am
Dbms Paper Open Ended 1 02122021 090519am
(Karachi Campus)
Department of Computer Engineering
OPEN ENDED LAB EXAM 1(A) – Fall 2021
[CLO 1: Mechanism]
Instructions:
Create word document with your name and registration no.
Copy queries and take screenshot of your output.
If found cheating, the paper will be cancelled and will be marked ZERO
Submit your lab exam on time.
Question1 :Construct datebase for given ERD and insert record ? [6 marks ]
Record to be inserted in database :
Perform following tasks using SQL commands: [10 Marks]
1. Write a SQL query to find the employees in the ascending order of their annual
salary. Return employee ID, employee name, monthly salary, salary/30 as
Daily_Salary, and 12*salary as Anual_Salary.
2. Write a SQL query to find the location of all the employees working in FINANCE
or AUDIT department. Sort the result-set in ascending order by department ID.
Return complete information about the employees.
3. Write a SQL query to find the employees along with grades in ascending order.
Return complete information about the employees.
4. Write a SQL query to find those departments where at least two employees work
as a SALESMAN in each grade. Return department name, grade and number of
employees
5. Write a SQL query to find those employees whose names contain the character
set 'LA' together. Return complete information about the employees
QUESTION#02:
1. Construct a database” School Management System”. Create Teacher and Student tables
in it having following columns and their appropriate data types: [01 Marks]
Table-Teachers
employee_id (PRIMARY KEY)
first_name
City
Address
hire_date
salary
S_id (INT NOT NULL)
Table-Student
S_id PRIMARY KEY,
S_name
2. Use DDL (Data Definition Language) to modify above database: [03 Marks]
a. Alter students table by adding a new column email data type VARCHAR length 200
b. Alter teachers table by adding two new columns as MIN_SALARY and
MAX_SALARY with data type DECIMAL
c. Alter students and drop email column from this table.
d.Alter Student table to add regno cnic no.
e. Alter Student table to add constraint unique on column regno