Sample_questions_MidSem_DBMS.docx
Sample_questions_MidSem_DBMS.docx
Marks:
Field Data type Constraint
Sno number (10) foreign key referring to Sno of student
Mark1 number (3) check !>100, default 0
Mark2 number (3) check !>100, default 0
Mark3 number (3) check !>100, default 0
Create a new relation or alter the existing relation based on the requirements given.
a. Display the student’s no, name, and their marks.
b. Compute and display the total marks, average of the students along with their roll no
name.
c. Display the student details no, name, marks irrespective to enrollment to exam.
d. Display the student sno, sname, representative id, and representative name.
e. Display the student sno, name, course_id, course_name irrespective to students’
admission in a course.
f. Display all student and course details.
2.Create tables named employee, department with the fields given below:
Employee:
Field Data type Constraint
Eno number(10) primary key
Ename varchar(15) not null
EDept varchar(10) foreign key
Edoj date
Esalary number(7)
Ecity varchar(15) default ‘sathy’
Ephone number unique
Department:
Field Data type Constraint
Dno number primary key
Dname varchar(15) unique
Dmgr number foreign key
a. Find the youngest employee in the work place (Based on work experience).
b. Display the detail of employees who are not belonging to sales dept.
c. Create a View named emp_mgr with the attributes eno, ename, and edept which store the
employee details who are manager. The data for the view can be derived from the base
table employee. Alter the base table as per the requirements.
o Display the contents of the View.
o Perform the insertion, deletion, and update operations in the View and check the base
table for the update.
3.Create tables named book, client with the fields given below:
Book:
Field Data type Constraint
Bno number(10) primary key
Btitle varchar(15) not null, unique
Bauthor varchar(10)
Bprice number check <= Rs.0
Client (Borrower):
Field Data type Constraint
Cno number(10) primary key
Cname varchar(15) not null
Caddress varchar(10) default ‘Coimbatore’
Bno number foreign key
Perform Join operations:
Note: Create a new relation or alter the existing relation based on the requirements given
a. Update the price of all books by adding Rs. 10 to their current prices.
b. Find the total number of books borrowed by clients.
c. Calculate and display the average price of books for each author.
d. Display the client name, book title, and author for clients who have borrowed books.
e. Display the names of clients who have borrowed books with a price greater than Rs. 50.
4.Create tables named customer, and account with the fields given below:
Customer:
Field Data type Constraint
Cno number(10) primary key
Cname varchar(15) not null
Cage number
Ccity varchar(15) default ‘sathy’
Cphone number unique
Account
Field Data type Constraint
Ano number(10) primary key
Balance number(10) check < Rs 500
Cno number foreign key
5.Create tables named employee, department with the fields given below:
Employee:
Field Data type Constraint
Eno number(10) primary key
Ename varchar(15) not null
EDept varchar(10) foreign key
Edoj date
Esalary number(7)
Ecity varchar(15) default ‘sathy’
Ephone number unique
Department:
Field Data type Constraint
Dno number primary key
Dname varchar(15) unique
Dmgr number foreign key
Client:
Field Data type Constraint
Cno number(10) primary key
Cname varchar(15) not null
Caddress varchar(10) default ‘sathy’
Bno number foreign key
a. Update the salary of all employees in the 'HR' department to Rs 70000.
b. Display the employee number, employee name, department number, and department
name for employees working in a department.
c. Display the book’s title start with letter ‘S’ / end with letter ‘A’
d. Use any 3 Date functions used in SQL
e. Create a View named book_author with the attributes bno, btitle, and author. The
data can be derived from the base table book.
● Display the contents of the View.
● Perform the insertion, deletion, and update operations in the View and check the
base table for the update.
7.Create tables named customer, account with the fields given below:
Customer:
Field Data type Constraint
Cno number(10) primary key
Cname varchar(15) not null
Cage number
Ccity varchar(15) default ‘sathy’
Cphone number unique
Account:
Field Data type Constraint
Ano number(10) primary key
Balance number(10) check < Rs 500
Cno number foreign key
1. Construct an E-R diagram for a car-insurance company whose customers own one or more
cars each. Each car has associated with it zero to any number of recorded accidents.
2. Construct an E-R diagram for a hospital with a set of patients and a set of medical doctors.
Associate with each patient a log of the various tests and examinations conducted.
3. Draw the E-R diagram which models an online bookstore.
4. Draw the E-R diagram which models an University database.Identify the possible entities and
relation.
5. Comstruct an E-R diagram for the Bank database.