BERNHARDT HIGH SCHOOL
LAB REPORT OF DBMS
SUBMITTED BY: ` SUBMITTED TO:
NAME: Rohan Pokharel …………………………………
GRADE: XII ‘F’ Department of Computer Science
ID CARD-NUMBER:12627
REGISTRATION NUMBER:
KATHMANDU, NEPAL
2081
Certificate
This is to certify that Mr Rohan Pokharel has successfully
completed his project work as per the requirement of the curriculum
of GRADE-XII (Computer Science) under National Education Board,
Nepal. He has completed his project work within the prescribed
period.
………………………………….
(NEB Symbol no/Registration no:)
………………………….. …………………………
Internal Examiner External Examiner
ACKNOWLEGEEMENT
I would like to express my deep appreciation and gratitude to my
subject teacher and lecturer Mr. Dinesh Khadka Sir for their
coinstantaneous help, advice, information and encouragement in this
project
I feel immense pleasure to present my project after a long work.
Besides my effort, the help and guideline given by many others hasn’t
been unnoticed. I express my gratitude to all those countless people
for the support for me in doing this project.
I express my thanks to BernHardt High School for it has been a
source of the creation of this project and the support, valuable
information, resources and guidance give to me to do this project.
I am also grateful and indebt of my beloved friends for their
immeasurable help, support and encouragement from the beginning to
the End of the project without whom this project would not have been
a reality.
Last but not the least I would like to thank my parents, family
members, friends, this College and other who help me for their
guidance and support.
Rohan Pokharel
1. Create a database name using format
"office_faculty_section_name".
For example: Student "rohan" from science faculty of
section "f" is "office_science_f_rohan".
= CREATE DATABASE office_science_h_rohan;
Output:
2. Choose just created database.
=USE office_science_f_rohan;
Output:
3. Create table "employee" with the following schema.
a. employee (Eid int, Name varchar (20), Address varchar
(30), Gender varchar (10), Department varchar (10), Post
varchar (15), Job_Status char (1))
b. Define Eid as Primary Key.
= CREATE TABLE employee (
Eid INT PRIMARY KEY,
Name VARCHAR(20),
Address VARCHAR(30),
Gender VARCHAR(10),
Department VARCHAR(10),
Post VARCHAR(15),
Job_Status CHAR(1)
);
Output:
4. Create table "salary" with the following schema.
a. salary (Eid int, Basic_Salary decimal (7,2), Allowance
decimal (7,2), D_Allowance decimal (7,2), Gross_Salary
decimal (7,2), Tax decimal (7,2), Net_Salary decimal (7,2))
b. Define Eid as foreign key with reference to primary key of
"employee" table.
= CREATE TABLE salary (
Eid INT,
Basic_Salary DECIMAL(7,2),
Allowance DECIMAL(7,2),
D_Allowance DECIMAL(7,2),
Gross_Salary DECIMAL(7,2),
Tax DECIMAL(7,2),
Net_Salary DECIMAL(7,2),
FOREIGN KEY (Eid) REFERENCES employee(Eid)
);
Output:
5. Insert the following 10 records into “employee” table.
Eid Name Address Gende Departme Post Job_Statu
r nt s
10 Aman Nepal Kirtipur Male Admin Officer P
1
10 Ram Karki Lalitpur Male Admin Assistan T
2 t
10 Sita Maharjan Chitwan Femal Accountant Officer T
3 e
10 Bibek Thapa Kathmand Male Accountant Manage P
4 u r
10 Anju Shrestha Chitwan Femal Admin Director P
5 e
10 Salin Malla Lalitpur Male Sales Manage T
6 r
10 Neeta Bista Kirtipur Femal Sales Officer P
7 e
10 Partham Kathmand Male Sales Assistan T
8 Dangol u t
10 Ritesh Basnet Lalitpur Male Store Officer P
9
11 Bisesh Kathmand Male Store Assistan P
0 Baskota u t
= INSERT INTO employee (Eid, Name, Address, Gender, Department, Post,
Job_Status) VALUES
(101, 'Aman Nepal', 'Kirtipur', 'Male', 'Admin', 'Officer', 'P'),
(102, 'Ram Karki', 'Lalitpur', 'Male', 'Admin', 'Assistant', 'T'),
(103, 'Sita Maharjan', 'Chitwan', 'Female', 'Accountant', 'Officer', 'T'),
(104, 'Bibek Thapa', 'Kathmandu', 'Male', 'Accountant', 'Manager', 'P'),
(105, 'Anju Shrestha', 'Chitwan', 'Female', 'Admin', 'Director', 'P'),
(106, 'Salin Malla', 'Lalitpur', 'Male', 'Sales', 'Manager', 'T'),
(107, 'Neeta Bista', 'Kirtipur', 'Female', 'Sales', 'Officer', 'P'),
(108, 'Partham Dangol', 'Kathmandu', 'Male', 'Sales', 'Assistant', 'T'),
(109, 'Ritesh Basnet', 'Lalitpur', 'Male', 'Store', 'Officer', 'P'),
(110, 'Bisesh Baskota', 'Kathmandu', 'Male', 'Store', 'Assistant', 'P');
Output:
6. Insert the following records into the “salary” table.
Eid Basic_Salar Allowanc D_Allowanc Gross_Salar Tax Net_Salar
y e e y y
10 50000.00 0.00 0.00 0.00 0.0 0.00
1 0
10 33000.00 0.00 0.00 0.00 0.0 0.00
2 0
10 55000.00 0.00 0.00 0.00 0.0 0.00
3 0
10 65000.00 0.00 0.00 0.00 0.0 0.00
4 0
10 75000.00 0.00 0.00 0.00 0.0 0.00
5 0
10 60000.00 0.00 0.00 0.00 0.0 0.00
6 0
10 45000.00 0.00 0.00 0.00 0.0 0.00
7 0
10 35000.00 0.00 0.00 0.00 0.0 0.00
8 0
10 60000.00 0.00 0.00 0.00 0.0 0.00
9 0
11 38000.00 0.00 0.00 0.00 0.0 0.00
0 0
= INSERT INTO salary (Eid, Basic_Salary, Allowance, D_Allowance,
Gross_Salary, Tax, Net_Salary) VALUES
(101, 50000.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(102, 33000.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(103, 55000.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(104, 65000.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(105, 75000.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(106, 60000.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(107, 45000.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(108, 35000.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(109, 60000.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(110, 38000.00, 0.00, 0.00, 0.00, 0.00, 0.00);
Output:
7. Display details of all employees from "employee" table.
= SELECT * FROM employee;
Output:
8. Display details of all employees from "employee" table whose
Job_Status is 'P'.
= SELECT * FROM employee WHERE Job_Status = 'P';
Output:
9. Display details of all employees from "employee" table whose
name starts with 'A'.
= SELECT * FROM employee WHERE Name LIKE 'A%';
Output:
10. Display details of all employees from "employee" table
whose name does not start with 'B'.
= SELECT * FROM employee WHERE Name NOT LIKE 'B%';
Output:
11. Display details of all employees from "employee" table
whose name has 't' as the third character.
= SELECT * FROM employee WHERE Name LIKE '__t%';
Output:
12. Display details of all employees from "employee" table
whose name begins with 'B' and ends with 'a'.
= SELECT * FROM employee WHERE Name LIKE 'B%a';
Output:
13. Display details of all employees from "employee" table
whose post is 'Manager'.
= SELECT * FROM employee WHERE Post = 'Manager';
Output:
14. Display details of all employees from "employee" table
whose post is not 'Officer'.
= SELECT * FROM employee WHERE Post not like 'Officer';
Output:
15. Calculate Allowance as 15% of Basic_Salary for all
employees.
= UPDATE salary SET Allowance = Basic_Salary * 0.15;
Output:
16. Calculate D_Allowance as 10% of Basic_Salary for all
employees.
= UPDATE salary SET D_Allowance = Basic_Salary * 0.10;
Output:
17. Calculate Gross_Salary as sum of Basic_Salary, Allowance,
and D_Allowance.
= UPDATE salary SET Gross_Salary = Basic_Salary + Allowance +
D_Allowance;
Output:
18. Calculate tax as 7.5% of Gross_Salary if Gross_Salary is
greater than 60000.
= UPDATE salary set Tax=0.075*Gross_Salary where
Gross_Salary>60000 ;
Output:
19. Calculate Net_Salary (Net_Salary = Gross_Salary - Tax).
= UPDATE salary SET Net_Salary = Gross_Salary - Tax;
Output:
20. Display all salary details of employees along with their
Eid, Name, and Post.
= SELECT [Link], [Link], [Link],
salary.Basic_Salary, [Link], salary.D_allowance,
salary.Gross_Salary, [Link], salary.Net_Salary
FROM employee
JOIN salary ON [Link] = [Link];
Output:
21. Display all employees details whose post is either
"Director", "Manager", or "Officer" with their Eid, Name, Post,
and Net_Salary.
= SELECT [Link], [Link], [Link],
salary.Net_Salary
FROM employee
JOIN salary ON [Link] = [Link]
WHERE [Link] IN ('Director', 'Manager', 'Officer');
Output:
22. Display all employees details with their Eid, Name, Post,
and Net_Salary.
= SELECT [Link], [Link], [Link],
salary.Net_Salary
FROM employee
JOIN salary ON [Link] = [Link];
Output: