Sei sulla pagina 1di 6

Pir Mehr Ali Shah

Arid Agriculture University, Rawalpindi


Office of the controller of Examinations
Final Exam (Practical)/ Spring 2020 (Paper Duration 48 hours)
To be filled by Teacher

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

Registration No.: 18-ARID-3040 Name: Sheikh Babar Ali

Answer the following questions.

Q.No.1. Do as Directed (Marks: 12)

1. Create a database named Bus Company.


2. Write a query to create a table of all entities and assume attributes as per your
convenience.
3. Write a query to create TWO DBA and allocate username and password other than
Scott and tiger.
4. Grant some rights just like DBA create the table, change password.
5. Write a query to revoke privileges.
6. Apply all constraints like primary key, foreign key, unique key, not null, and check
constraint.
7. Create a view that will show only the Bus and route description.
8. Create a view to show the details of the bus and garage.
9. Create a synonym of the bus as metro-bus, route as public route, and driver as captain.
10. Create sequence and index of attributes associated with bus and town tables.
11. Insert 5 rows in each table and each table must follow the normalization principles.
12. Create a query to update the more than one column values in bus records with the help
of a single query.
Answer:
1.
CREATE DATABASE BUSCOMPANY;

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;

CREATE SEQUENCE TownSeq START WITH 1000 INCREMENT BY 150


MINVALUE 1000
MAXVALUE 9999999 NOCYCLE;
11.
INSERT INTO BUS values (BusSeq.nextval,'BUSINESS','DAEWOO');
INSERT INTO BUS values (BusSeq.nextval,'ECONOMY','DAEWOO');
INSERT INTO BUS values (BusSeq.nextval,'BUSINESS','FAISAL');
INSERT INTO BUS values (BusSeq.nextval,'ECONOMY','FAISAL');
INSERT INTO BUS values (BusSeq.nextval,'BUSINESS','AL HALAL');

INSERT INTO Garage values (10,67);


INSERT INTO Garage values (12,70);
INSERT INTO Garage values (15,88);
INSERT INTO Garage values (5,60);
INSERT INTO Garage values (20,100);

INSERT INTO Town values (TownSeq,'Murree','Rawalpindi','MP');


INSERT INTO Town values (TownSeq,'Lahore','Rawalpindi','LP');
INSERT INTO Town values (TownSeq,'Karachi','Lahore','KL');
INSERT INTO Town values (TownSeq,'Rawalpindi','Peshawar','RP');
INSERT INTO Town values (TownSeq,'Islamabad','Lahore','IL');

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');

INSERT INTO STAGE VALUES ('murre');


INSERT INTO STAGE VALUES ('lahore');
INSERT INTO STAGE VALUES ('karachi');
INSERT INTO STAGE VALUES ('rawalpindi');
INSERT INTO STAGE VALUES ('islamabad');

INSERT INTO DRIVER VALUES (1,26,'AHMAD');


INSERT INTO DRIVER VALUES (5,30,'QASIM');
INSERT INTO DRIVER VALUES (9,40,'MAJEED');
INSERT INTO DRIVER VALUES (13,44,'AKRAM');
INSERT INTO DRIVER VALUES (15,29,'BILAL');

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.

Define Entitlements and Deductions


Define entitlements and deductions, The entitlements could be Basic Salary, Allowance, Provident
Fund, Medical Facilities etc. Further, you need to define different types of deductions such as
Advance Salary, Salary Tax, Social Security Fund etc.

Define Salary for each employee


Define the salary of every individual employee. The employees could be working full time, part-time,
contract basis, daily basis, hourly basis etc. You have to set the salary effective date, different kinds of
entitlements and deductions applicable, Provident fund, etc. You can just import the salary structure
of all the employees at one go. 

Monthly Payroll Generation


Generate payroll of your employees for a given month. Once the payroll is generated it needs to be
approved. Once it is approved, employees will be able to view how much they are paid, their
deduction, the taxes paid and other details about their monthly income. The system also generates the
tax based on Nepal Government Rule.

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.

Adjustable payroll month


Can set up your payroll month as per the need.

Advance setting for Payroll


Can set different settings as per the company policy. This setting can be applied to the entire
company, a particular branch, a department or an employee.  The following are a few examples;

 Adjust Overtime Rate for working day or for a non-working day


 Calculate Overtime only after an employee has worked for specified hours than regular office
hours

 Count absent if late for specified hours

 Define whether to deduct salary for absent days

 Define whether to deduct salary for insufficient worked hours


 Define whether to deduct salary for leaving the office early

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

Potrebbero piacerti anche