You are on page 1of 2

CST 122-3: Database Management Systems - I (Practical) Exercise 02

Take screen shots of the table creations and query outputs for the following questions and
upload answers to the VLE as a pdf document naming it with your registration number.

1. Create a database called “BookShop”.


2. Within that database, create a table called “Book” with the following fields.

Field Name Type Field Size


BookID Text (varchar) 5
Title Text (varchar) 50
Author Text (varchar) 30
Category Number (int)
Price_Rs Currency (decimal) 8,2
PubID Text (char) 6

3. Insert the following data into the “Book” table.

BookID Title Author Category Price_Rs PubID


B1 Excel R. David 2 1800.00 Pub002
B2 Computers M. Thomas 4 2500.00 Pub002
B3 Access P. Paul 2 3000.00 Pub003
B4 Arts W. Shiva 1 1000.00 Pub004
B5 Science A. Rahul 3 900.00 Pub001

4. Write queries for the following requirements.


i. Display all the details in the Book table.

ii. Display all the titles of the books.

iii. Display all the titles of the books with prices.

iv. Display the Book ID, the Title and the Author.

v. Display the details of the book with the book ID ‘B2’.

vi. Display the titles of the books with the prices less than Rs.2000.00.

vii. Display the details of the books in category 2.


viii. Display all the titles in the Book table in ascending order.

ix. Display all the details in the Book table in descending order by price.

x. Display all the details inthe Booktable in ascending orderby category and title.

xi. Display all the details in the Book table in descending order by category and
ascending order bytitle.

5. Change the category as 3 of the book with the BookID ‘B3’.


6. Change the price of the book with the BookID ‘B3’ by adding Rs.100.00 to the current price.
7. Delete the details of the book with the BookID ‘B1’.
8. Delete all the books in category 3.
9. Remove all the data in the Book table.
10. Drop the database“BookShop”.

You might also like