DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
CMR TECHNICAL CAMPUS
Kandlakoya (V), Medchal Road, Hyderabad
Course: B.Tech Date: 25-04-2017
Year: II-II-Sem
DBMS LAB EXTERNAL EXAM QUESTION PAPER
1. i. Design the following Database using E-R Diagram
Database Schema for a customer-sale scenario
Customer (Cust id : integer, cust_name: string)
Item (item_id: integer, item_name: string, price: integer)
Sale (bill_no: integer, bill_data: date, cust_id: integer, item_id: integer, qty_sold: integer)
ii. For the above schema, perform the following—
a) Insert around 10 records in each of the tables
b) List all the bills for the current date with the customer names and item numbers
iii. Write a program to find largest number from the given three numbers.
2. i. Design the following Database using E-R Diagram
Database Schema for a Student Library scenario
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)
ii. For the above schema, perform the following—
a) Insert around 10 records in each of the tables
b) List all the student names with their membership numbers and name must be start with k and last but one t.
iii. Simple programs using loop, while and for iterative control statement.
3. i. Design the following Database using E-R Diagram
Database Schema for a Employee-pay scenario
Employee (emp_id : integer, emp_name: string)
department (dept_id: integer, dept_name:string)
paydetails (emp_id : integer, dept_id: integer, basic: integer, deductions: integer, additions: integer, DOJ: date)
payroll (emp_id : integer, pay_date: date)
ii. For the above schema, perform the following—
a. Insert around 10 records in each of the tables
b. List the employee details department wise
iii. Write a program to check whether the given number is Armstrong or not
4. i. Design the following Database using E-R Diagram
Database Schema for a Video Library scenario
Customer (cust_no: integer, cust_name: string)
Membership (mem_no: integer, cust_no: integer)
Cassette (cass_no:integer, cass_name:string, language: string)
Iss_rec(iss_no: integer, iss_date: date, mem_no: integer, cass_no: integer)
ii. For the above schema, perform the following—
a) Insert around 10 records in each of the tables
b) List all the customer names with their membership numbers and names must be contains second character is p.
iii. Write a program to generate all prime numbers below 100.
5. i. Design the following Database using E-R Diagram
Database Schema for a student-Lab scenario
Student (stud_no: integer, stud_name: string, class: string)
Class (class: string, descrip: string)
Lab (batch_no: integer, lab_no: integer, description: String)
Allotment (stud_no: Integer, batch_no: integer, dayofweek: string)
ii. For the above schema, perform the following—
a) Insert around 10 records in each of the tables
b) List all the machine allotments with the student names, lab and machine numbers
iii. Write a program to demonstrate the GOTO statement.
6. i. Design the following Database using E-R Diagram
Database Schema for a customer-sale scenario
Customer(Cust id : integer, cust_name: string)
Item(item_id: integer, item_name: string, price: integer)
Sale(bill_no: integer, bill_data: date, cust_id: integer, item_id: integer, qty_sold: integer)
ii. For the above schema, perform the following—
a) List the total Bill details with the quantity sold, price of the item and the final amount
b) List the details of the customer who have bought a product which has a price>200
iii. Create a procedure to find reverse of a given number
7. i. Design the following Database using E-R Diagram
Database Schema for a Student Library scenario
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)
ii .For the above schema, perform the following—
a) List all the issues for the current date with student and Book names
b) List the details of students who borrowed book whose author is CJDATE
iii. Create a trigger before/after update on employee table for each row/statement.
8. i. Design the following Database using E-R Diagram
Database Schema for a Employee-pay scenario
Employee (emp_id : integer, emp_name: string)
Department (dept_id: integer, dept_name:string)
Paydetails (emp_id : integer, dept_id: integer, basic: integer, deductions: integer, additions: integer, DOJ: date)
Payroll (emp_id : integer, pay_date: date)
ii. For the above schema, perform the following—
a) List all the employee names who joined after particular date
b) List the details of employees whose basic salary is between 10,000 and 20,000
iii. Create a trigger before/after delete on employee table for each row/statement.
9. i. Design the following Database using E-R Diagram
Database Schema for a Video Library scenario
Customer (cust_no: integer, cust_name: string)
Membership (Mem_no: integer, cust_no: integer)
Cassette (cass_no:integer, cass_name:string, Language: String)
Iss_rec(iss_no: integer, iss_date: date, mem_no: integer, cass_no: integer)
ii. For the above schema, perform the following—
a) List all the issues for the current date with the customer names and cassette names
b) List the details of the customer who has borrowed the cassette whose title is “ The Legend”
iii. Create a trigger before/after insert on employee table for each row/statement.
10. i. Design the following Database using E-R Diagram
Database Schema for a student-Lab scenario
Student (stud_no: integer, stud_name: string, class: string)
Class (class: string, descrip: string)
Lab (batch_no: integer, Lab_no: integer, description: String)
Allotment (Stud_no: Integer, batch_no: integer, dayofweek: string)
ii. For the above schema, perform the following—
a) List the total number of lab allotments day wise
b) Give a count of how many machines have been allocated to the ‘CSIT’ class
iii. Create a trigger before/after insert on employee table for each row/statement.
11. i. Design the following Database using E-R Diagram
Database Schema for a customer-sale scenario
Customer (Cust id : integer, cust_name: string)
Item (item_id: integer, item_name: string, price: integer)
Sale (bill_no: integer, bill_data: date, cust_id: integer, item_id: integer, qty_sold: integer)
ii. For the above schema, perform the following—
a) Give a count of how many products have been bought by each customer
b) Give a list of products bought by a customer having cust_id as 5
iii. Create a trigger before/after delete on employee table for each row/statement.
12. i. Design the following Database using E-R Diagram
Database Schema for a Student Library scenario
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)
ii. For the above schema, perform the following—
a) Give a count of how many books have been bought by each student
b) Give a list of books taken by student with stud_no as 5
iii. Create a trigger before/after update on employee table for each row/statement.
13. i. Design the following Database using E-R Diagram
Database Schema for a Employee-pay scenario
employee(emp_id : integer, emp_name: string)
department(dept_id: integer, dept_name:string)
paydetails(emp_id : integer, dept_id: integer, basic: integer, deductions: integer, additions: integer, DOJ: date)
payroll(emp_id : integer, pay_date: date)
ii. For the above schema, perform the following—
a) Give a count of how many employees are working in each department
b) Give a names of the employees whose netsalary>10,000
iii. Create a procedure to find reverse of a given number
14. i. Design the following Database using E-R Diagram
Database Schema for a Video Library scenario
Customer(cust_no: integer,cust_name: string)
Membership(Mem_no: integer, cust_no: integer)
Cassette(cass_no:integer, cass_name:string, Language: String)
Iss_rec(iss_no: integer, iss_date: date, mem_no: integer, cass_no: integer)
ii. For the above schema, perform the following—
a) Give a count of how many cassettes have been borrowed by each customer
b) Give a list of book which has been taken by the student with mem_no as 5
iii. Write a program to generate all prime numbers below 100.
15. i. Design the following Database using E-R Diagram
Database Schema for a student-Lab scenario
Student(stud_no: integer, stud_name: string, class: string)
Class(class: string, descrip: string)
Lab(mach_no: integer, Lab_no: integer, description: String)
Allotment(Stud_no: Integer, mach_no: integer, dayof week: string)
ii. For the above schema, perform the following—
a) Give a machine allotment details of the stud_no 5 with his personal and class details
b) Count for how many machines have been allocated in Lab_no 1 for the day of the week as “Monday”
iii. Write a program to demonstrate the GOTO statement.
16. i. Design the following Database using E-R Diagram
Database Schema for a customer-sale scenario
Customer(Cust id : integer, cust_name: string)
Item(item_id: integer, item_name: string, price: integer)
Sale(bill_no: integer, bill_data: date, cust_id: integer, item_id: integer, qty_sold: integer)
ii. For the above schema, perform the following—
a) List the item details which are sold as of today
b) Create a view which lists out the bill_no, bill_date, cust_id, item_id, price, qty_sold, amount Create a view which
lists the daily sales date wise for the last one week
iii. Write a program to find largest number from the given three numbers.
17. i. Design the following Database using E-R Diagram
Database Schema for a Student Library scenario
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)
ii. For the above schema, perform the following—
a) List the book details which are issued as of today
b) Create a view which lists out the iss_no, iss _date, stud_name, book name
iii. Simple programs using loop, while and for iterative control statement.
18. i. Design the following Database using E-R Diagram
Database Schema for a Employee-pay scenario
employee(emp_id : integer, emp_name: string)
department(dept_id: integer, dept_name:string)
paydetails(emp_id : integer, dept_id: integer, basic: integer, deductions: integer, additions: integer, DOJ: date)
payroll(emp_id : integer, pay_date: date)
ii. For the above schema, perform the following—
a) List the details for an employee_id=5
b) Create a view which lists out the emp_name, department, basic, dedeuctions, netsalary
iii) Write a program to check whether the given number is Armstrong or not
19. i. Design the following Database using E-R Diagram
Database Schema for a Video Library scenario
Customer(cust_no: integer,cust_name: string)
Membership(Mem_no: integer, cust_no: integer)
Cassette(cass_no:integer, cass_name:string, Language: String)
Iss_rec(iss_no: integer, iss_date: date, mem_no: integer, cass_no: integer)
ii. For the above schema, perform the following—
a) List the cassettes issues for today
b) Create a view which lists outs the iss_no, iss_date, cust_name, cass_name
iii. Write a program Fibonacci series.
20. i. Design the following Database using E-R Diagram
Database Schema for a student-Lab scenario
Student(stud_no: integer, stud_name: string, class: string)
Class(class: string, descrip: string)
Lab(batch_no: integer, Lab_no: integer, description: String)
Allotment(Stud_no: Integer, batch_no: integer, dayofweek: string)
ii. For the above schema, perform the following—
a) How many students class wise have allocated machines in the labs
b) Create a view which lists out the stud_no, stud_name, mach_no, lab_no, dayofweek Create a view which lists the
machine allotment details for “Thursday”
iii. Simple programs using loop, while and for iterative control statement.
21. i. Design the following Database using E-R Diagram
Database Schema for a customer-sale scenario
Customer(Cust id : integer, cust_name: string)
Item(item_id: integer, item_name: string, price: integer)
Sale(bill_no: integer, bill_data: date, cust_id: integer, item_id: integer, qty_sold: integer)
ii. For the above schema, perform the following—
a) List the item details which are sold as of today
b) List the details of the customer who have bought a product which has a price>200
iii. Write a program to find largest number from the given three numbers.
22. i. Design the following Database using E-R Diagram
Database Schema for a Student Library scenario
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)
ii. For the above schema, perform the following—
a) Create a view which lists the daily issues-date wise for the last one week
b) List all the issues for the current date with student and Book names
iii. Write a program to check whether the given number is Armstrong or not
23. i. Design the following Database using E-R Diagram
Database Schema for a Employee-pay scenario
employee(emp_id : integer, emp_name: string)
department(dept_id: integer, dept_name:string)
paydetails(emp_id : integer, dept_id: integer, basic: integer, deductions: integer, additions: integer, DOJ: date)
payroll(emp_id : integer, pay_date: date)
ii. For the above schema, perform the following—
a) Create a view which lists the emp_name and his netsalary
b) List the details of employees whose basic salary is between 10,000 and 20,000
iii. Write a program to generate all prime numbers below 100.
24. i. Design the following Database using E-R Diagram
Database Schema for a Video Library scenario
Customer(cust_no: integer,cust_name: string)
Membership(Mem_no: integer, cust_no: integer)
Cassette(cass_no:integer, cass_name:string, Language: String)
Iss_rec(iss_no: integer, iss_date: date, mem_no: integer, cass_no: integer)
ii. For the above schema, perform the following—
a) Create a view which lists issues-date wise for the last one week
b) List the details of the customer who has borrowed the cassette whose title is “ The Legend”
iii. Write a program to demonstrate the GOTO statement.
25. i. Design the following Database using E-R Diagram
Database Schema for a student-Lab scenario
Student(stud_no: integer, stud_name: string, class: string)
Class(class: string, descrip: string)
Lab(batch_no: integer, Lab_no: integer, description: String)
Allotment(Stud_no: Integer, batch_no: integer, dayof week: string)
ii.For the above schema, perform the following—
a) Give a count of how many machines have been allocated to the ‘CSIT’ class
b) List the total number of lab allotments day wise
iii. Create a trigger before/after insert on employee table for each row/statement.