DBMS Lab Manual 29
DBMS Lab Manual 29
Index
SR. Page no
Experiment Title
Date Of Date Of
NO Marks Sign.
from To Performance Submission
4.
To study Single-row functions.
8. Manipulating Data
1
NAME: vura vamsi srinivas
ENROLL NO. : 200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
2
NAME: vura vamsi srinivas
ENROLL NO. : 200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
PRACTICAL 1
AIM :To study DDL-create and DML-insert commands.
(2) Create Table Branch (BNAME VARCHAR2 (20), CITY VARCHAR2 (20));
(3) Create Table Customers (CNAME VARCHAR2 (20), CITY VARCHAR2 (20));
(4) Create Table Borrow (LOANNO VARCHAR2 (4), CNAME VARCHAR2 (20), BNAME
VARCHAR2 (20), AMOUNT NUMBER (8, 2));
3
NAME: vura vamsi srinivas
ENROLL NO. : 200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
Table 1:DEPOSIT
Table 2: BRANCH
Table 3: CUSTOMER
Table 4: BORROW
4
NAME: vura vamsi srinivas
ENROLL NO. : 200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
(iii) From the above given tables perform the following queries:
(1) Describe deposit, branch.
5
NAME: vura vamsi srinivas
ENROLL NO. : 200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
6
NAME: vura vamsi srinivas
ENROLL NO. : 200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
(8) Give name of customers who opened account after date '5-SEP-95.
Practical 2
AIM : Create the below given table and insert the data accordingly.
7
NAME: vura vamsi srinivas
ENROLL NO. : 200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
8
NAME: vura vamsi srinivas
ENROLL NO. : 200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
9
NAME: vura vamsi srinivas
ENROLL NO. :200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
(2) Give details of account no. and dopened between dates 01-01-12 and 25-07-16
(3) Display all jobs with minimum salary is greater than 40000.
10
NAME: vura vamsi srinivas
ENROLL NO. :200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
(4) Display name and salary of employee whose department no is 120. Give alias name
to name of employee.
(5)Display employee no, name and department details of those employee whose department lies
in (110,120).
(3) Display name, number and salary of those employees whose name is 5
characters long and first three characters are ‘Ma’.
(4) Display the non-null values of employees and also employee name second
character should be ‘n’ and string should be 5 character long.
(5) Display the null values of employee and also employee name’s third character
should be ‘r’.
11
NAME: vura vamsi srinivas
ENROLL NO. :200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
PRACTICAL 3
AIM: To perform various data manipulation commands, aggregate functions and
sorting concept on all created tables.
(1) List total deposit from deposit.
Select count(*) from deposit;
(4) Create table supplier from employee with all the columns.
12
NAME: vura vamsi srinivas
ENROLL NO. :200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
(9) Update the value of employee name whose employee number is 105.
13
NAME: vura vamsi srinivas
ENROLL NO. :200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
(12) Create table sup1 from employee with first two columns.
14
NAME: vura vamsi srinivas
ENROLL NO. :200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
(14) Insert the data into sup2 from employee whose second character should be ‘n’
and string should be 5 characters long in employee name field.
(15) Update the value dept no to 10 where second character of emp. Name is ‘m’.
15
NAME: vura vamsi srinivas
ENROLL NO. :200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
PRACTICAL 4
AIM- To study Single-row functions.
(1) Write a query to display the current date. Label the column Date .
(2) For each employee, display the employee number, job, salary, and salary increased by 15%
and expressed as a whole number. Label the column New Salary
(3) Modify your query no 4.(2) to add a column that subtracts the old salary from the new salary.
Label the column Increase
(4) Write the query that display the employee’s name 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 employee’s last name.
16
NAME: vura vamsi srinivas
ENROLL NO. :200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
(5) Write a query that produces the following for each employee:
<employee name> earns <salary> monthly
(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.
(7) Write a query to calculate the annual compensation of all employees (sal+comm.).
17
NAME: vura vamsi srinivas
ENROLL NO. :200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
Practical 5
(2) 5) Give name of customer who are borrowers and depositors and having living city Delhi
(3) Give city as their city name of customers having same living branch.
18
NAME: vura vamsi srinivas
ENROLL NO. :200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
Practical 6
AIM: To apply the concept of Aggregating Data using Group functions.
2) Display the highest, lowest, sum, and average salary of all employees. Label the
columns Maximum, Minimum, Sum, and Average, respectively. Round your results to the
nearest whole number.
3) Write a query to display the total salary being paid to each job title, within each
department.
4) Find the average salaries > 2000 for each department without displaying the
respective department numbers.
Practical 7
AIM: To solve queries using the concept of sub query.
19
NAME: vura vamsi srinivas
ENROLL NO. :200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
1) Write a query to display the last name and hire date of any employee in the same
department as SCOTT. Exclude SCOTT.
2)Give name of customers who are depositors having same branch city of mr. sunil.
3)Give deposit details and loan details of customer in same city where pramod is living.
4)Create a query to display the employee numbers and last names of all employees who earn
more than the average salary. Sort the results in ascending order of salary.
20
NAME: vura vamsi srinivas
ENROLL NO. :200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
5)Display the department number, name, and job for every employee in the Accounting
department.
Practical 8
AIM: Manipulating Data.
21
NAME: vura vamsi srinivas
ENROLL NO. :200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
(2) Give 15% interest to all depositors living in Nagpur and having branch
city Bombay.
(3) Transfer 1000 Rupees from account of Anil to Sunil if both are having
same branch.
22
NAME: vura vamsi srinivas
ENROLL NO. :200303124539
FACULTY OF ENGINEERING & TECHNOLOGY
SUBJECT NAME: DBMS
SUBJECT CODE: 203105252
B.Tech: IT Year: 2 Semester: 4
23
NAME: vura vamsi srinivas
ENROLL NO. :200303124539