You are on page 1of 17

ANNA UNIVERSITY: CHENNAI 600 025

B.E/B.Tech DEGREE EXAMINATIONS, APRIL/MAY 2013


Regulations 2008
Fourth Semester
Common to B.E (CSE) / B.Tech(IT)
CS2258 Database Management Systems Lab

Time: 3Hours

Maximum Marks: 100

1. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Product (Prodid, Prodesc, Price, Stock)
Purchase (Purid, Proid, qty, supname)
Sales (Saleid, Proid, qty, custname)
a. Update the Stock of all products by 10.
b. Display products whose stock is <15 and order it by stock.
c. Display list of product details (Prodid, Prodesc, Price)
supplied by a particular supplier(ABC).
d. Product ids and Sum of quantity purchased
e. Product details (Prodid, Prodesc, Price) of products which are purchased
as well as sold.
f. Create a procedure which accepts a prodid and displays all the sales and
purchase records of it.
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Queries (a-e)

(10 x 5 =50) marks

Procedure (f)

(20) marks

2. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Product (Prodid, Prodesc, Price, Stock)
Purchase (Purid, Proid, qty)
a. Add a column customer name in Purchase table.
b. Productids which are not at all purchased.
List of product details (Prodid, Prodesc, Price) purchased by a particular
customer. (MATHEW).
c. The number of customers who made the purchases
d. List of the productids and total quantity purchased
e. Product ids of the products which are purchased more than 5 times
f. Create a procedure to print the Prodid and qty when the Purid is given as
the parameter.
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Queries (a-e)

(10 x 5 =50) marks

Procedure (f)

(20) marks

3. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Customer (Custid, Custname, Age, phno)
Loan (Loanid, Amount, Custid, Emi)
a. Customerids who have not taken Loan
b. Loan details (Loanid, Amount, Custid ) of Loan taken by a particular
customer(JOHN)
c. The Total number of Loans aviailed
d. List of the customerids and total Loan amount taken
e. Customer ids who have taken less than 2 Loans
f. Create a procedure to print the Amount and Custid when the Loanid is
given as the parameter.
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Queries (a-e)
Procedure (f)

(10 x 5 =50) marks


(20) marks

4. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Customer (Custid, Custname, Age, phno)
HLoan (HLoanid, Amount, Custid)
VLoan (VLoanid, Amount, Custid)
a. Update the HLoan amount by reducing 5000 rupees which is a special
discount offer.
b. Number of VLoan taken by a particular customer id.
c. Customer details (Custid, Custname, Age, phno) who have taken HLoan
d. List of the customerids and total VLoan amount taken
e. Customer details (Custid, Custname, Age, phno) who have taken both
Hloan and VLoan
f. Create a procedure to print the Amount and HLoanid when the Custid is
given as the parameter.
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Queries (a-e)
Procedure (f)

(10 x 5 =50) marks


(20) marks

5. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Customer (Custid, Custname, Addr, phno,panno)
Loan (Loanid, Amount, Interest,Custid)
Account (Accd, Accbal, Custid)
a. Add a column CUSDOB in customer table.
b. Select the customers whose name ends with SINGH and order by custid
c. Display the customerids and sum of his account balances
d. Display the accounts of customerids C01,C02,C03
e. Select the customername,id of customers whose number of accounts is
greater than
f. Create a procedure to print the Loan details when Customer name is given
as the parameter.
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Queries (a-e)
Procedure (f)

(10 x 5 =50) marks


(20) marks

6. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Product (Prodid, Prodesc, Price, Stock)
Purchase (Purid, Proid, qty, supname)
Sales (Saleid, Proid, qty, custname)
a. Display supname when a particular product id is given (DAL23).
b. List of names who are both supplier as well as customer.
c. Create a Trigger which reduces the stock of Product that is been inserted
in sales and update the stock when purchase is made
d. Create a view which displays Product ids and sum of quantity in sales.
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)
Queries (b-d)

(10) marks
(20 x 3 =60) marks

7. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Product (Prodid, Prodesc, Price, Stock,Reord)
Sales (Salesid, Proid, qty)
a. Display Prodesc of products of particular Sales(SA234).
b. Display the amount (price * qty) of Products in each Sales.
c. Create a Trigger which reduces the stock of Product that is been inserted
in sales and print if it is out of stock (stock <Reord)
d. Create a view which displays Proid, Prodesc and sum of quantity in sales.
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)
Queries (b-d)

(10) marks
(20 x 3 =60) marks

8. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Customer (Custid, Custname, Age, phno)
Loan (Loanid, Amount, Custid, Emi)
a. Display the total Emi that need to be paid by customer with a particular
Custname(LEENA)
b. Add a column nol and update the column values with sum of Loans taken
by him
c. Create a Trigger which updates the nol value on insertion and deletion of
Loan for a customer.
d. Create a View with Custname and sum of Loan Amount

Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)
Queries (b-d)

(10) marks
(20 x 3 =60) marks

9. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Customer (Custid, Custname, Age, phno)
HLoan (HLoanid, Amount, Custid)
VLoan (VLoanid, Amount, Custid)
a. Display Custname name with both HLoan and VLoan
b. List of the customerids and total VLoan amount taken
c. Create a Trigger which displays the HLoan details when values in HLoan
is inserted, do the same for VLoan also.
d. Create a view with Custid and Custname with sum of Loan Amount(both
HLoan and VLoan)
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)
Queries (b-d)

(10) marks
(20 x 3 =60) marks

10. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Customer (Custid, Custname, Addr, phno,panno)
Loan (Loanid, Amount, Interest, Custid)
Account (Accd, Accbal, Custid)
a. Display the sum of Accbal of a Particular Custname(LEENA)
b. Update the interest with 1% when Accbal of the Custid >50% of Loan
Amount
c. Create a Trigger which checks whether the Accbal is 25% of amount to be
inserted in Loan
d. Create a View with Accbal and Loan Amount of all Cutomers
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)
Queries (b-d)

(10) marks
(20 x 3 =60) marks

11. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Customer (Custid, Custname, Addr, phno,panno)
Loan (Loanid, Amount, Interest, Custid)
Account (Accd, Accbal, Custid)
a. Display the Custname having both Loan and Account
b. Create an user defined function getBal which returns the Sum of Accbal
of a particular Custid passed as parameter
c. Create a procedure which prints the Customer details whose sum of
Accbal >10000 using getBal function created by user above (in b)
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)

(20) marks

Function (b)

(25) marks

Procedure (c)

(25) marks

12. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Customer (Custid, Custname, Addr, phno,panno)
Loan (Loanid, Amount, Interest, Custid, PrincipalPaid)
Account (Accd, Accbal, Custid)
a. Display the Custname doesnt hold any Account nor taken any Loan
b. Create an user defined function getBalance which returns the Balance
Principal Loan Amount Pending for a Particular Custid passed as
parameter
c. Create a procedure which prints the Customer details whose have Balance
Principal Loan Amount Pending >0 using getBalance function created
by user above (in b)
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)

(20) marks

Function (b)

(25) marks

Procedure (c)

(25) marks

13. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Customer (Custid, Custname, Addr, phno,panno)
Loan (Loanid, Amount, Interest, Custid, LoanDate)
a. Display number of Loans, the sum of Loan Amount of a Particular
Custname(LEENA)
b. Create a Report (using Crystal Reports/ Any report generation tool) which
displays Loan Taken between From and To Dates

Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)

(20) marks

Report (b)

(50) marks

14. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Product (Prodid, Prodesc, Price, Stock, Reord)
Sales (Salesid, Proid, qty)
a. Display the total amount (price * qty) of Sales made so far
b. Create a Report (using Crystal Reports/ Any report generation tool) when
Given with a Proid generates the list of sales made with sum of quantity
sold
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)

(20) marks

Report (b)

(50) marks

15. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Customer (Custid, Custname, Addr, phno,panno)
Loan (Loanid, Amount, Interest, Custid, LoanDate)
a. Display number of Total Loan Amount taken on LoanDates and order by
Loan Date then by Loan Amount
b. Create a Form to make a Loan entry (using VB/ VC++/Java).
c.

Loan can be entered only for available customer so display available


Custid in the Form to Choose one among them for Loan Entry

Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)

(20) marks

Form (b)

(40) marks

Constraint ( c )

(10) marks

16. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Product (Prodid, Prodesc, Price, Stock, Reord)
Sales (Salesid, Proid, qty)
a. Double the Reord value of Products with Price >500 and Reord <50
b. Create a Form to make a Sale entry (using VB/ VC++/Java).
c.

Sale can be entered only for available products so display available


Prodid in the Form to Choose one among them for Sale Entry

Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)

(20) marks

Form (b)

(40) marks

Constraint ( c )

(10) marks

17. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Product (Prodid, Prodesc, Price, Stock)
Sales (Salesid, Proid, qty)
a. Add a column Reord with a value of 50 for all the products.
b. Create
i. A Product Menu (using VB/ VC++/Java) with options
1. Add
2. Delete
3. Update
ii. A Sale Menu
1. to insert a Sale made
c. Implement Only Add Product menu operation with a Form (with db
connectivity)
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)

(15) marks

Menu Design (b)

(30) marks

Form (c)

(35) marks

18. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Customer (Custid, Custname, Addr, phno)
Loan (Loanid, Amount, Interest, Custid, LoanDate)
a. Add a column nol(number of loans) and set its value calculating it from
loan table.
b. Create
i. A Customer Menu (using VB/ VC++/Java) with options
1. Add
2. Delete
3. Update
ii. A Loan Menu
1. to insert Loan details
c. Implement Only Add Customer menu operation with a Form (with db
connectivity)

Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)

(15) marks

Menu Design (b)

(20) marks

Form (c)

(35) marks

19. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Product (Prodid, Prodesc, Price, Stock)
Sales (Salesid, Proid, qty)
a. Add a column Reord with a value of 50 for all the products.
b. Create
i. A Sale Menu (using VB/ VC++/Java) with options
1. to insert a Sale made
2. Sales Report
c. Implement Only Sales Report menu operation listing Sales made so far.
(using Crystal Reports/ Any report generation tool)
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)

(15) marks

Menu Design (b)

(20) marks

Report (c)

(45) marks

20. Create Tables as follows by choosing appropriate data type and set the necessary
primary and foreign key constraints:
Customer (Custid, Custname, Addr, phno)
Loan (Loanid, Amount, Interest, Custid, LoanDate)
a. Add a column nol(number of loans) and set its value calculating it from
loan table.
b. Create
i. A Loan Menu (using VB/ VC++/Java) with options
1. to insert Loan details
2. Loans Availed Report
c. Implement Only Loans Availed Report menu operation (using Crystal
Reports/ Any report generation tool)
Marks:
Table creation and Data Insertion

(15)

Appropriate Constraints and Data Type

(15)

Query (a)

(15) marks

Menu Design (b)

(20) marks

Report (c)

(45) marks

You might also like