0% found this document useful (0 votes)
33 views

DBMS Lab Cycle

1. The document outlines 10 lab cycles for a database management systems course. Each cycle covers different topics like DDL commands, datatypes, queries, and creating sample databases to demonstrate concepts. 2. Lab cycles 1-5 focus on creating sample tables for topics like sailors, boats, insurance data, orders and books. Lab cycles also include queries to retrieve information from the tables. 3. Lab cycles 6-10 create additional sample databases for students, banking, and books. These cycles also include queries to demonstrate concepts like joins, aggregates, updates and deletes.

Uploaded by

anand chawan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

DBMS Lab Cycle

1. The document outlines 10 lab cycles for a database management systems course. Each cycle covers different topics like DDL commands, datatypes, queries, and creating sample databases to demonstrate concepts. 2. Lab cycles 1-5 focus on creating sample tables for topics like sailors, boats, insurance data, orders and books. Lab cycles also include queries to retrieve information from the tables. 3. Lab cycles 6-10 create additional sample databases for students, banking, and books. These cycles also include queries to demonstrate concepts like joins, aggregates, updates and deletes.

Uploaded by

anand chawan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

DBMS Lab Cycle

Lab Topics to be discussed


DDL Commands: Create, Alter, Drop, Rename, Truncate
DCL Commands: Grant, Revoke
1
TCL Commands: Commit, Rollback, Save point
Datatypes: CHAR, VARCHAR, DATE, TIME, NUMBER, INT
DML Commands: Insert, Update, Delete, Select
2
CONSTRAINTS: NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK
Create table for the following:
Sailors (sid: integer, sname: string, rating: integer, age: real)
Boats (bid: integer, bname: string, color: string)
Reserves (sid: integer, bid: integer, day: date)

1) Create the above tables by properly specifying the primary keys and the foreign keys.
3 2) Enter at least five tuples for each relation.
3) Find the names of sailors who have reserved boat number 103?
4) Find the names and sids of sailors who have reserved a red and a green boat?
5) Find the names of sailors who have reserved a red boat?
6) Find the colors of boats reserved by ‘Lubber’?
7) Find the names of sailors who have reserved atleast one boat?
8) Find the ages of sailors whose name begins and ends with B and has atleast 3 characters?
Database to manage the insurance of a vehicle. The relations with their respective
attributes are shown below.
PERSON (DRIVER ID, NAME, ADDRESS)
CAR (REGNO, MODEL, YEAR)
ACCIDENT (REPORTNO,DATE,LOCATION)
OWNS(DRIVERID,REGNO)
PARTICIPATED(DRIVERID,REGNO,REPORTNO,DAMAGEAMOUNT)

1) Create the above tables by properly specifying the primary keys and the foreign keys.
4
2) Enter at least five tuples for each relation.
 3) Query to update the damage amount for the car with a specific register number in the
accident with report number between 1 & 200.
 4) Query to find the total number of people who owned the cars that were involved in
accidents in 2002.
 5) Query to find the number of accidents in which cars belonging to a specific model were
involved.
 6) Query to check if a person with a specific driver_id has met with an accident in 2003.
 7) Query to display name of a person & the car he/she owns.
Consider the following relations for an order processing database application in a company.
CUSTOMER (Cust #: int, Cname: string, City: string)
5 ORDER (Order #: int, Odate: date, Cust #: int, Ord-Amt: int)
ORDER-ITEM (Order #: int, Item #: int, qty: int)
ITEM (Item #: int, Unit Price: int)
SHIPMENT (Order #: int, Warehouse #: int, Ship-Date: date)
WAREHOUSE (Warehouse #: int, City: string)

1) Create the above tables by properly specifying the primary keys and the foreign keys.
2) Enter at least five tuples for each relation.
3) Produce a listing: CUSTNAME, NO_OF_ORDERS, AVG_ORDER_AMT, where the middle
column is the total number of orders by the customer and the last column is the average
order amount for that customer.
4) List the Order# for the orders that were shipped from all the warehouses that the
company has in a specific city.
5) List the order numbers of all orders placed by customers who belong to a particular city.
6) List the details of all orders that the company has received.
6 TEST-1
Consider the following database of student enrollment in courses and books adopted for
each course.
STUDENT (REGNO :STRING , NAME : STRING , MAJOR : STRING , BDATE : INT)
COURSE (COURSE# : INT , CNAME : STRING , DEPT : STRING)
ENROLL ( REGNO : STRING , COURSE#: INT , SEM : INT , MARKS : INT )
BOOK_ADAPTION ( COURSE#: INT , SEM : INT , BOOK_ISBN :INT)
TEXT (BOOK_ISBN : INT , BOOK-TITLE : STRING , PUBLISHER : STRING , AUTHOR : STRING).

7 1) Create the above tables by properly specifying the primary keys and the foreign key.
2) Enter atleast five tuples for each relation.
3) Demonstrate how you add a new text book to the database and make this book be
adopted by some department
4) Produce a list of textbooks in the alphabetic order for courses offered by the ‘CS’
department that use more than two books
5) List any department that has all its adopted books published by a specific Publish er.
6) List the number of students for each course.
7) List name and USN of the students of a specific course.
Consider the following relations for the details maintained by a book dealer.
AUTHOR (Author-id: int, Name: string, City: string, Country: string)
PUBLISHER (Publisher-id: int, Name: string, City: string, Country: string)
CATALOG (Book-id: int, title: string, author-id: int, Publisher-id: int, Category-id: int, Year:
int, Price: int)
CATEGORY (Category-id: int, Description: string)
ORDER-DETAILS (Order-no : int, Book-id: int, Quantity: int)
8
1) Create the above tables by properly specifying the primary keys and the foreign keys.
2) Enter at least five tuples for each relation.
3) Give the details of the authors who have 2 books in the catalog and the price of the
books is greater than the average price of the books in the catalog and the year of
publication is after 2000.
4) Query to demonstrate how to retrieve the author of the book which has maximum sales.
5) Query to demonstrate how to increase the price of the books published by a specific
publisher by 10%.
Consider the following database for a banking enterprise
BRANCH (branch_name: string, branch_city: string, assets: real)
ACCOUNT (accno: int, branch_name: string, balance: real)
CUSTOMER (customer_name: string, customer_street: string, city: string)
DEPOSITOR (customer_name: string, accno: int)
LOAN (loan_number: int, branch_name: string, amount: real)
BORROWER (customer_name: string, loan_number: int)

1) Create the above tables by properly specifying the primary keys & the foreign keys.
9
2) Enter atleast five tuples for each relation.
3) Find all the customers who have at least two accounts at the Main branch.
4) Find all the customers who have an account at all the branches located in a specific city.
5) Query to demonstrate how you delete all account tuples at every branch located in a
specific city.
6) Display the names of all the customers who have taken loan, count of the number of
loans taken and the total amount taken up each customer.
7) Find the names of all the customers who have taken the loan in a particular branch.
8) Update the balance for the customer with a given customer name to 10000.
10 TEST-2

You might also like