Part - A: Database Management System Lab
Part - A: Database Management System Lab
Part - A: Database Management System Lab
PART - A
A1. The STUDENT detail databases has a table with the following attributes. The primary keys are
underlined. STUDENT(regno: int, name: string, dob: date, marks: int)
i) Create the above table.
ii) Remove the existing attribute marks from the table.
iii) Change the date type of regno from integer to string.
iv) Add a new attribute phoneno to the existing table.
v) Enter five tuples into the table.
vi) Display all the tuples in student table.
A3. The SALARY database of an organization has a table with the following attributes.
EMPSALARY(empcod:int, empname:string, dob:date, department:string, salary:real)
i) Create the above table.
ii) Enter the five tuples into the table
iii) Display all the number of employees working in each department.
iv) Find the sum of the salaries of all employees.
v) Find the sum and average of the salaries of employees of a particular department.
vi) Find the least and highest salaries that an employee draws.
A4. Consider the insurance database given below. The primary keys are underlined and the data
types are specified.
PERSON(driver-id-no: string, name: string, address: string)
CAR(regno: string, model: string, year: int)
ACCIDENT(report-no: int, date: date, location: String)
OWNS(driver-id-no: string, regno: string)
PARTICIPATED(driver-id-no: string, regno: string, report-no: int, damage-amount: int)
i) Create the above tables by properly specifying the primary keys and the foreign keys
ii) Enter atleast five tuples for each relation.
iii) Demonstrate how you
a) Update the damage amount for the car with a specific regno in the accident with
report no 102 to 25000.
b) Add a new accident to the database.
iv) Find total number of people who owned cars that were involved in accidents in 2013
v) Find the number of accidents in which cars belonging to a specific model were involved
DATABASE MANAGEMENT SYSTEM LAB
PART - B
B1. EmpMaster(Empcode,Ename,Deptname)
B2. EmpSalary(Empcode,Ename,Salary)
B3. Students(Regno,Name,Course,Sem)
B4. StudentMarks(Regno,Name,Course,Marksobtained)
B5. CustomerDetail(CustomerID,Name,Dept,City)
PART – A
A1. STUDENT(regno: int, name: string, dob: date, marks: int)
i) Create the above table.
ii) Remove the existing attribute marks from the table.
iii) Change the date type of regno from integer to string.
iv) Add a new attribute phoneno to the existing table.
v) Enter five tuples into the table.
vi) Display all the tuples in student table.
DATABASE MANAGEMENT SYSTEM LAB
DATABASE MANAGEMENT SYSTEM LAB
A3. The SALARY database of an organization has a table with the following attributes.
EMPSALARY(empcod:int, empname:string, dob:date, department:string, salary:real)
i) Create the above table.
ii) Enter the five tuples into the table
iii) Display all the number of employees working in each department.
iv) Find the sum of the salaries of all employees.
v) Find the sum and average of the salaries of employees of a particular department.
vi) Find the least and highest salaries that an employee draws.
DATABASE MANAGEMENT SYSTEM LAB
DATABASE MANAGEMENT SYSTEM LAB
A4. Consider the insurance database given below. The primary keys are underlined and the data
types are specified.
PERSON(driver-id-no: string, name: string, address: string)
CAR(regno: string, model: string, year: int)
ACCIDENT(report-no: int, date: date, location: String)
OWNS(driver-id-no: string, regno: string)
PARTICIPATED(driver-id-no: string, regno: string, report-no: int, damage-amount: int)
i) Create the above tables by properly specifying the primary keys and the foreign keys
ii) Enter at least five tuples for each relation.
iii) Demonstrate how you
b) Update the damage amount for the car with a specific regno in the accident with
report no 103 to 25000.
b) Add a new accident to the database.
iv) Find total number of people who owned cars that were involved in accidents in 2013
v) Find the number of accidents in which cars belonging to a specific model were involved
DATABASE MANAGEMENT SYSTEM LAB
DATABASE MANAGEMENT SYSTEM LAB
DATABASE MANAGEMENT SYSTEM LAB
Update the damage amount for the car with a specific regno in the accident with
report no 102 to 25000.
Find total number of people who owned cars that were involved in accidents in 2013
Find the number of accidents in which cars belonging to a specific model were involved
DATABASE MANAGEMENT SYSTEM LAB
A5. Consider the following database of students enrollment in courses and books adopted for each
course.
STUDENT(regno: string, name: string, major: strong, bdate: date)
COURSE(course-no: int cname: string, dept: string)
ENROLL(reg-no: string, course-no: int, sem: int, marks: int)
BOOK-ADOPTION(course-no: int, sem: int, book-isbn: int)
TEXT(book-isbn: int, book-title: string, publisher: string, author: string)
i) Create the above tables by properly specifying the primary keys and the foreign keys
ii) Enter atleast five tuples for each relation.
iii) Demonstrate how you add a new text book to the database and make this book be adopted by
some department.
iv) List any department that has all its adopted books published by a specific publisher.
DATABASE MANAGEMENT SYSTEM LAB
DATABASE MANAGEMENT SYSTEM LAB
Find all the customers who have atleast two accounts at the main branch.
Find all customer who have an account at all the branches located in a specific
city.
Demonstrate how to delete all account tuples at every branch located in specific
city.
DATABASE MANAGEMENT SYSTEM LAB
PART – B
B1. EmpMaster(Empcode,Ename,Deptname)
a)
b)
c)
d)
DATABASE MANAGEMENT SYSTEM LAB
e)
DATABASE MANAGEMENT SYSTEM LAB
a)
b)
c)
DATABASE MANAGEMENT SYSTEM LAB
d)
e)
DATABASE MANAGEMENT SYSTEM LAB
B3. Students(Regno,Name,Course,Sem)
a)
b)
DATABASE MANAGEMENT SYSTEM LAB
c)
d)
e)
DATABASE MANAGEMENT SYSTEM LAB
B4. StudentMarks(Regno,Name,Course,Marksobtained)
a)
b)
DATABASE MANAGEMENT SYSTEM LAB
c)
d)
e)
DATABASE MANAGEMENT SYSTEM LAB
B5. CustomerDetail(CustomerID,Name,Dept,City)
a)
b)
DATABASE MANAGEMENT SYSTEM LAB
c)
d)
e)
DATABASE MANAGEMENT SYSTEM LAB