0% found this document useful (0 votes)
35 views

Practical 4 Dbms

Paper

Uploaded by

nocknock127
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Practical 4 Dbms

Paper

Uploaded by

nocknock127
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

ITM (SLS) Baroda University

School of computer Science, Engineering and Technology


Semester-3

Subject Name : DBMS Subject Code : 2130703

Practical - 4
Queries to be performed:
To create table Employee:

CREATE TABLE Employe (empno VARCHAR(80), name VARCHAR(80), job VARCHAR(80), mgr
VARCHAR(80), hiredate DATE, sal VARCHAR(80), comm VARCHAR(80), deptno VARCHAR(80));

Inserting Data into Tables:


Insert Data in Employee:
INSERT INTO Employe(empno, name, job, mgr, hiredate, sal, comm, deptno)
values(7566, "jones", "manager", 7839, "1981-04-02", 2975.00, NULL, 20),
(7788, "scoot", "analyst", 7566, "1987-04-19", 3000.00, NULL, 20),
(7876, "adams", "clerk", 7788, "1987-05-23", 1100.00, NULL, 20),
(7902, "ford", "analyst", 7566, "1981-12-03", 3000.00, NULL, 20),
(7369, "smith", "clerk", 7902, "1980-12-17", 800.00, NULL, 20),
(7698, "blake", "manager", 7839, "1981-05-01", 2850.00, NULL, 30),
(7499, "allen", "salesman", 7698, "1981-02-20", 1600.00, 300.00, 30),
(7521, "ward", "salesman", 7698, "1981-02-22", 1250.00, 500.00, 30),
(7654, "martin", "salesman", 7698, "1981-09-28", 1250.00, 500.00, 30),
(7844, "turner", "salesman", 7698, "1981-09-28", 1500.00, 0, 30);

Queries to be performed:

(1) Write a query to display the current date. Label the column Date.

Output:

Name : Bishnoi Sunil


Enrollment No. : 23C23002 Page | 1
ITM (SLS) Baroda University
School of computer Science, Engineering and Technology
Semester-3

Subject Name : DBMS Subject Code : 2130703


(2) For each employee, display the employee number, Employee Job, and salary increased by 15% and
expressed as a whole number. Label the column New Salary.

Output:

(3) Modify your query no 4.(2) to add a column that subtracts the old salary from the new salary. Label
the column Increase.

Output:

Name : Bishnoi Sunil


Enrollment No. : 23C23002 Page | 2
ITM (SLS) Baroda University
School of computer Science, Engineering and Technology
Semester-3

Subject Name : DBMS Subject Code : 2130703


(4) Write a query that displays the employee’s names with the first letter capitalized and all other letters
lowercase, and the length of the names, for all employees whose name starts with J, A, or M. Give each
column an appropriate label. Sort the results by the employees’ last names.

Output:

(5)Write a query that produces the following for each employee: <employee last name> earns <salary>
monthly.

Output:

Name : Bishnoi Sunil


Enrollment No. : 23C23002 Page | 3
ITM (SLS) Baroda University
School of computer Science, Engineering and Technology
Semester-3

Subject Name : DBMS Subject Code : 2130703


(6) Display the name, hire date, number of months employed and day of the week on which the employee
has started. Order the results by the day of the week starting with Monday.

Output:

(7) Display the hiredate of emp in a format that appears as Seventh of June 1994 12:00:00 AM.

Output:

Name : Bishnoi Sunil


Enrollment No. : 23C23002 Page | 4
ITM (SLS) Baroda University
School of computer Science, Engineering and Technology
Semester-3

Subject Name : DBMS Subject Code : 2130703

(8) Write a query to calculate the annual compensation of all employees (sal+comm.).

Output:

*******

Name : Bishnoi Sunil


Enrollment No. : 23C23002 Page | 5

You might also like