Model-FAT Lab
Model-FAT Lab
Instructions
1. Give Commit Command every 10mns to save your schemas in the database.
2. Copy the content from sql prompt to word doc file frequently.
3. As this is a proctored examination, it is appropriate to turn-on the video during the en-
tire duration of the test. However, keeping in view the network / bandwidth issues, stu-
dents are required to switch-on the video as and when it is required by the course fac-
ulty.
4.Keep your laptop with proper power backup and related software.
In your answer sheet copy all the queries from Query Number 3
Upload your text files using the link given below VTop Stu
File upload should be done only once. Only files with the naming convention registration
number.txt [example-17BCE0001.doc] will be accepted. Multiple file uploads are not allowed.
Components Marks
DDL(15)
DML (25)
PL/SQL (10)
SET 1
Consider the following relations for an order processing database application in a
Company
Item Id Price
SET -1
3. Display the order ID ,Customer Id and Item ID of all customers who are above 30 years of
Age [5]
4. Update the customer name Chris parker as Chris Churchill using the replace function. [4]
5. Display the Order_ID ,Item ID and Price of all items ordered by the customer and also price
of items that are not ordered by any customers [4]
6. Display the customer ID customer name, total Order amount for all customers who have
made a total order that is more than 10000 rupees [4]
7. Display the total number of times a particular item has been ordered. For instance 441 is
present in orders with order id 21 and 40, therefore the count for item id 441 is 2. [4]
8. Using subqueries display all the customer names who are from Houston and whose order
quantity is greater than 50 from the order_items table. [4]
9. Write a Pl/Sql block to retrieve name, salary of the particular employee identified by ssn
from employee table by reading ssn value during run time [10]
SET 2
Consider the following relations for database that keeps track of business trips of
salespersons in a sales office:
Salesperson
Trip
Trip assignment
Department
SET 3
Consider the following relational schema:
Hotel (hotelno:integer, hotelname:string, city:string)
Guest (guestno:integer,guestname:string,guestaddress:string)
1. Create the above mentioned tables and insert necessary records. [10]
2. Insert the following constraints on the tables [5]
Hotel
Hotel_no primary Key
Insert not null constraint on hotel_city
Room
Room_no primary key , Hotel_no foreign key
Insert a check constraint on price such that price should not be greater than 10000
Booking
Hotel_no ,Room_no,Guest_no foreign Keys
Hotel_no+Room_no+Guest_no primary key
Guest
Guest_no primary key
3. List the hotel id,hotel name and room numbers that was booked for more than two months.
[5]
4. List the hotel_no and hotel_name and Room_no,price for hotels that have the room price
details and also the hotels that don’t have the room price details [4]
5. Using subqueries display the names of all the guests who are from new york and who have
booked the room number 3. [4]
6. Display the total price of bookings for each guest.For instance for guest id 111 the total
price of bookings is 5500 (4500 for room number 3 and 1000 for room number 8) [4]
7. Create a view that has hotel name ,guest name of all guests who have booked a room with a
check in date that is not greater than may 2012 [4]
8. Display the total number of rooms booked by each guest. For instance guest number 111 has
booked two rooms (room number 3 and room number 8) [4]
9. Write a PL SQL program to calculate area of a circle given its radius [10]
SET 4
Movie Table
Movie Id Movie Name Movie Release Collection
Date
Movie Category
Category Minimum Maximum
Collection Collection
Theatre Table
Theatre Id Theatre name Location Capacity
3. Display the Movie ID,Movie Name and Category for each movie depending on the
collection [5]
4. Display the movie Id ,movie name ,Theatre Id ,Theatre name for all movies that have a
theatre and also movies which does not have a theatre. [4]
5. Using subqueries display the names of all the movies that released after May 2014 at
Marcus Theatres. [4]
6. Display the total collection for each theatre in the descending order. [4]
7. Create a view that has the Movie Id Movie name and Theatre name of all movies that come
8. Display the theatre name and total number of movies for each theatre. [4]
9. Write a PL/SQL block to find out Simple Interest given P=10000, N=2 and R=10% [10]
SET 5:
Product Table
Product Id Product Name Manufactured Date Expiry Date
Primary Key Name should not be
null
Quality Table
Quality Index Minimum_Defect_rate Maximum_Defects_rate
Should be unique
Sold Table
Product Id Date Sold
Foreign Key
SET -5
2. Insert the given records in the tables and enforce the constraints [7.5]
3. Display the details of products that will expire within three years from the date of
manufacture [5]
4. Using sub queries display the names of all products which has a manufacturing date less
than five months from the current date and whose defect rate is 0 [4]
6. Create a view name prod_view that consist only of product id product name, price and
quality index of all products that have a quality index greater than 1. [4]
7. Display total number of products sold based on the price of each product [4]
8. Display the product name of all products whose total number of products sold is greater