You are on page 1of 7

SNM INSTITUTE OF MANAGEMENT & TECHNOLOGY

Department of Computer Science and Engineering


Lab Cycle : CSL333 DATABASE MANAGEMENT SYSTEMS LAB
FIRST CYCLE
LAB 1

1
Creation of database schema - DDL (create tables, set constraints, enforce relationships, create
indices, delete and modify tables).

Design a database schema for an application with ER diagram from bank databases. *
1. Branch<branch name(pk),branch city(unique),assets>
2. customer<cu_no(pk),cu_name(not null), cu_street,cu_city>
3. loan<loan number(pk), branch name(fk),amount(not null)>
4. Borrower<cu_no(fk),loan_no(fk)>
5. Account <ac_no(pk),br_name,balance(not null)>
6. depositor<cu_no(fk),ac_no(fk)>
2
Practice SQL commands for DML (insertion, updating, altering, deletion of data, and
viewing/querying records based on condition in databases)

Create Emp table(e_no(pk),f_name (not null),l_name,gender(check ‘m’/’f’),designation


(not null), dept_name(not null),DOJ,sal,age(always>18),status(check 'g','p'))
A. List all the details
B. modify designation of a particular employee
C. list f_name , designation, dept_name of all employees
D. insert only e_no,f_name,designation, dept_name for 2 employees
E. add all other details for the above employees
F. list f_name & job of all employees who belong to HR department
G. delete the details of a particular employee
H. change the emp table to employee
I. get the description of emp table and, display old and new table
J. list the permanent employees
K. list all employee names & their salaries whose salary lies between 15,000 & 35,000
both inclusive( use between clause).
L. List employees, department and designation whose designation is manager or clerk or
accountant(use IN)
M. list employees whose f_name contains 'Raj' embedded in it
N. list employees which starts with S or D
O. list employees whose designation is 'MGR' & age is less than 40
MINIPROJECT PHASE 1
LAB 2

3
Design a normalized database schema with ER diagram for the following requirement.
The requirement: A library wants to maintain the record of books, members, book issue, book
return, and fines collected for late returns, in a database. The database can be loaded with book
information. Students can register with the library to be a member. Books can be issued to
students with a valid library membership. A student can keep an issued book with him/her for a
maximum period of two weeks from the date of issue, beyond which a fine will be charged.
Fine is calculated based on the delay in days of return. For 0-7 days: Rs 10, For 7 – 30 days: Rs
100, and for days above 30 days: Rs 10 will be charged per day
4 Implementation of Build in functions in RDBMS (string,numeric,date and time)
INVENTORY(Stores name, price, model, year of manufacturing, fuel type)
CUSTOMER:(customer Id, name, address, phone number , email )
SALE:((invoice number, car Id, customer id, sale date, mode of payment, sales person’s
employee Id, and selling price )---of the car sold,
EMPLOYEE(employee Id, name, date of birth, date of joining, designation, salary )…of
each employee in the showroom.
A. Calculate GST as 12% of Price and display the result after rounding it off to one
decimal place.
B. Add a new column FinalPrice to the table inventory, which will have the value as sum
of Price and 12% of the GST.
C. Calculate and display the amount to be paid each month (in multiples of 1000) which is
to be calculated after dividing the FinalPrice of the car into 10 instalments.
D. d) After dividing the amount into EMIs, find out the remaining amount to be paid
immediately, by performing modular division. Following SQL query can be used to
solve the above mentioned problems:
E. Add a new column Commission to the SALE table. The column Commission should
have a total length of 7 in which 2 decimal places to be there.
F. calculate commission for sales agents as 12 per cent of the SalePrice, insert the values
to the newly added column Commission and then display records of the table SALE
where commission > 73000
G. Display customer name in lower case and customer email in upper case from table
CUSTOMER
H. Display emails after removing the domain name extension “.com” from emails of the
customers.
I. Display details of all the customers having yahoo emails only
J. Select the day, month number and year of joining of all employees.

5 Implementation of various aggregate functions in SQL[ use Emp table ]


A. list minimum, maximum & average salaries of employee
B. what is the difference between maximum & minimum salaries of employees in the
organization
C. find out how much amount the company is spending towards salaries
D. find the average salary of female employees
A. find number of departments in employee table
MINIPROJECT PHASE 1

SECOND CYCLE
LAB 3
6 Implementation of Order By, Group By& Having clause. *
A. display minimum & maximum age of employees for each department[emp table]
B. display department vice average salary of employees whose average salary is greater
than 40,000.[emp table]
C. Display the number of cars purchased by each customer from the SALE table.
D. Display the customer Id and number of cars purchased if the customer purchased more
than 1 car from SALE table
E. Display the number of people in each category of payment mode from the table SALE.
F. Display the PaymentMode and number of payments made using that mode more than
once

7 Implementation of set operators, nested queries and Join queries *


A. Find all loan numbers for loans made at the Ernakulam branch with loan amounts
greater than Rs10000
B. Find all loan numbers for loans with loans amounts between Rs90,000 & Rs1,00,000
C. Find all customers who have a loan from bank, find their names, loan numbers & loan
amounts using join
D. Find the customer names, loan numbers & loan amounts for all loans at the
Moothakunam branch using join
E. Find all customers having a loan, an account or both at the bank with out duplicates
F. Find all customers having a loan, an account or both at the bank with duplicates
G. Find all customers having both a loan and an account at the bank with out duplicates
H. Find all customers who have an account but no loan at the bank with out duplicates
I. Find all customers having both a loan and an account at the bank using nested query
J. Find all customers who have an account but no loan at the bank using nested query
K. Find all customers who have both an account and a loan at the Ernakulam branch

MINIPROJECT PHASE 2
LAB 4

8 Student(Stud_no : integer, Stud_name: string)

Membership(Mem_no: integer, Stud_no: integer)

Book(book_no: integer, book_name:string, author: string)

Iss_rec(iss_no:integer, iss_date: date, Mem_no: integer, book_no: integer)

For the above schema, perform the following—

a) Create the tables with the appropriate integrity constraints


b) Insert around 10 records in each of the tables
c) List all the student names with their membership numbers
d) List all the issues for the current date with student and Book names
e) List the details of students who borrowed book whose author is CJDATE
f) Give a count of how many books have been bought by each student
g) Give a list of books taken by student with stud_no as 5
h) List the book details which are issued as of today
9 Practice of SQL TCL commands like Rollback, Commit, Savepoint **.
10 Practice of SQL DCL commands for granting and revoking user privileges **.
LAB 5
11 Practice of SQL commands for creation of views and assertions
12 Implementation of various control structures using PL/SQL *
Write a program to find largest number from the given three numbers.
13 PL/SQL program to print the sum numbers between m and n. (using simple loop, while & for)
MINIPROJECT PHASE 2
THIRD CYCLE
LAB 6
14 Creation of Procedures
A. Book return should insert an entry into the Book_Return table and also update the status
in Book_Issue table as ‘Returned’. Create a database TRANSACTION to do this
operation (stored procedure
B. Create a database procedure to add, update and delete a book to the Library database
(use parameters).
15 Creation of Functions
A. Book return should insert an entry into the Book_Return table and also update the status
in Book_Issue table as ‘Returned’. Create a database TRANSACTION to do this
operation.

B. Create a database procedure to add, update and delete a book to the Library database
(use parameters).
LAB 8
16 Creation of database Triggers and Cursors *
A. Implement a triggers to implement admission of the college
1. Close the admission of college after ’31-July-2015’
2. Update the number of vacancies after insertion/updation in the admission table
College_vacancies(deptname,totalseats,admitted,vacancy)
admission(branch,sid,sname,Dob,Address,m_phy,m_che,m_bio_com,m_maths,m_t
ot)
B. Create a history table (you may use the same structure without any keys) for the
MEMBER table and copy the original values of the row being updated to the history
table using a TRIGGER.
LAB 9
17
A. Use cursors and create a procedure to print Books Issue Register
B. PL/SQL program to calculate total marks of each student using Cursor
(s_no,s_name,dept_name,maths,os,dbms,total(initially empty))
MINIPROJECT PHASE 3
LAB 10
18 Creation of Packages
19 Creation of PL/SQL blocks for exception handling
LAB 11
20 Familiarization of NoSQL Databases and CRUD operations
21 Mini project final
Design a database application using any front end tool for any problem selected. The
application constructed should have five or more tables
Integration of modules
MINIPROJECT PHASE 1 …Coding of module 1
MINIPROJECT PHASE 2…..Coding of module 2
MINIPROJECT PHASE 3 …… Coding of module 3

You might also like