Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Course No.: CS-400, Course Title: Database Systems, Total Marks: 20, Date of Exam: August, 4, 2020.
Degree: BS (SE), Semester: 4th Evening, Section: A
Marks
Q.No. 1 2 3 4 5 6 7 8 9 10 Obtained/
Total Marks
Marks
Obtained
Total Marks in Words:
Name of the teacher: Dr. Yaser Hafeez
Who taught the course: Signature of teacher / Examiner:
To be filled by Student
2.
CREATE TABLE Bus(
BusNumber int(11) PRIMARY KEY NOT NULL,
TYPE VARCHAR(50),
Name VARCHAR(50) );
CREATE Table Garage(
NumberOfBuses int(11),
SizeTotal int(11) );
CREATE Table Town(
PostalCode int(11) PRIMARY KEY,
Name VARCHAR(20),
DISTRICT VARCHAR(20),
Name2 VARCHAR(20));
CREATE Table Route(
RouteName VARCHAR(20));
CREATE Table Stage(
StageName VARCHAR(20));
CREATE Table Driver(
DriverID int(11),
Age int(11),
Name VARCHAR(20) );
CREATE INDEX Bus_Type
ON BUS(name,TYPE);
3.
CREATE USER bobbyop
IDENTIFIED BY mypassword;
CREATE USER aleem
IDENTIFIED BY madtoy;
4.
GRANT CREATE TABLE TO bobbyop;
GRANT ALTER USER TO bobbyop;
GRANT CREATE TABLE TO aleem;
GRANT ALTER USER TO aleem;
5.
REVOKE CREATE TABLE FROM bobbyop;
6.
ALTER TABLE Stage ADD PRIMARY KEY (StageName);
ALTER TABLE Town ADD FOREIGN KEY(StageName) REFERENCE Stage(StageName);
ALTER TABLE BUS ADD CONSTRAINT BUSCT CHECK (TYPE
IN('BUSINESS','ECONOMY'));
ALTER TABLE BUS MODIFY NAME VARCHAR(20) UNIQUE NOT NULL;
7.
CREATE VIEW BUSNROUTE As
SELECT * FROM BUS,Route;
8.
CREATE VIEW BUSNGarage As
SELECT * FROM BUS,GARAGE;
9.
CREATE SYNONYM MetroBus FOR Bus;
CREATE SYNONYM PublicRoute FOR Route;
CREATE SYNONYM Captain FOR driver;
10.
CREATE SEQUENCE BusSeq START WITH 0 INCREMENT BY 1
MINVALUE 0
MAXVALUE 100 NOCYCLE;
INSERT INTO Route values ('MP'); INSERT INTO Route values ('LP');
INSERT INTO Route values ('KL'); INSERT INTO Route values ('RP');
INSERT INTO Route values ('IL');
12.
UPDATE DRIVER
SET Age='30', Name='Bakir'
WHERE DriverID='15';
Q.No.2. (Marks 8)
Describe your semester project and construct a normalized relational schema of your semester
project.
Answer:
Project : Attendance And Payroll Management System
An Attendance Management Software is a part of the HRMS that helps in the maintenance of the
attendance of the employees over a period of time. Attendance plays a prominent role in the
distribution of salaries of an employee. So, with the help of the attendance management software,
keeping a tab on all the employees becomes easy.
Bank Advice
When the payroll is generated, you can send bank advice to the bank to deposit salary in the
employees’ accounts.
Monthly Payslip
The employees will be able to see the salary they have earned, the provident fund, Tax, other
deductions and more online.
Advance Salary
Record the advance salary provided to employees and set deduction schedule on a monthly basis.
While generating salary sheet, the system deducts the advance salary as per the setting.
ADMIN
ADMIN ID
USERNAME
PASSWORD EMPLOYEES
ADMIN ID
NAME EMPLOYEE ID
PHOTO NAME
CREATED ON ADDRESS
DATE OF BIRTH
CONTACT INFO
GENDER
POSITION
SCHEDULE
INCLUDE PHOTO
CREATED ON
POSITION
DESCRIPTION
RATE
EMPLOYEE ID EM
PL
OY
EE
ID
OVERTIME
HOURS
RATE
CASH ADVANCE DATE OVERTIME
DATE
EMPLOYEE ID
AMOUNT
INCLUDE
DEDUCTION
DESCRIPTION SCHEDULES
AMOUNT TIME IN
TIME OUT