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

Member

Uploaded by

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

Member

Uploaded by

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

SELF REVIEW EXERCISES IN SQL :

1) Create the following tables :


1. Member master table :member
Column Name Format Remarks .
member_id varchar2(5) Primary key
lname varchar2(15)
fname varchar2(15)
area varchar2(20)
phone_no number(10)

2. Books mastertable :books


Column Name Format Remarks
Book_id varchar2(10) Primary key
title varchar2(80)
type char(3)
author varchar2(20)
price number(9,2)

3. Transaction table :transaction


Column Name Format Remarks
t_id varchar2(3) primary key
book_id varchar2(10)
member_id varchar2(5)
issue_date date
retum_date date

2) Insert the following data into their respective tables :


1. Data for membertable :
Member_id lname fname Area Phone_no
M01 George Mathew MAS 9988776600
M02 Sneha Sawanth CBE 9843267123
M03 Jeeva Pramod DEL 9956754257
M04 Neeraj Basu HSR 8093373978
M05 Sreeram Kumar MYL NULL
M06 NULL Sri CBE 9873484635
2. Data for bookstable :

Book_id Title Type Author Price


B00001 The Essential Client/Server Survival Guide CSE Robert Orfali 5000

B00002 Data Structures Using C And C++ CSE Aaron.M.Tenenbaum 1000

B00003 Digital Design ECE M Morris Mano 2500


B00004 The C Odyssey Unix - The Open, Boundless CSE Meeta Gandhi 7300
C
B00005 Computer System Architecture IC M Morris Mano 3500

B00006 An Introduction To Distributed And Parallel IT Joel M Crichlow 4200


Computing
B00007 Type And Learn C++ Today ECE Martin L Rinehart 1500

B00008 Pc Buyers Survival Guide IC Harald Babiel 4560

B00009 Digital Electronics And Microprocessors ECE R P Jain 3500


Problems And Solutions

B00010 Easy To Build Electronic Alarms ECE M C Sharma 1900


B00011 Unix Network Programming CSE W Richard Stevens 2200
B00012 C++ Programming Language IT Bjarne Stroustrup 3450

3. Data for transactiontable :transaction


t_id book_id member_id issue_date return_date
t01 B00004 M01 22-jun-19 25-aug-19 .
t02 B00003 M02 12-aug-19 15-aug-19 .
t03 B00001 M02 15-aug-19 18-aug-19 .
t04 B00006 M03 10-sep-19 13-sep-19 .
t05 B00007 M04 05-aug-19 08-aug-19 .
t06 B00002 M06 18-sep-19 21-sep-19 .
t07 B00009 M05 07-jul-19 10-jul-19 .
t08 B00009 M01 11-aug-19 14-aug-19 .
t09 B00005 M03 06-jul-19 09-jul-19 .
t10 B00008 M06 03-sep-19 06-sep-19 .
SQL SENTENCE CONSTRUCTS FOR PRACTICE:
Single Table Retrieval .

1. Find out the names of all the members.


2. Print the entire member table.
3. Retrieve the list of fname and the area of all the members.
4. List the various book types available from the book table without duplicates.
5. Find the names of all members having ’a’ as the second letter in theirfnames.
6. Find thelnamesof all members that begin with ’s‘ or ’j’.
7. Find out the members who stay in an area whose second letter is ’B’.
8. Find the list of all members who stay in area ‘MYL’ or ‘CBE’ or ‘DEL’.
9. Print the list of members whose phonenumbers greaterthan the value 9800000000
10. Print the information from transaction table of members who have beenissued books in
the monthof september.
11. Display the transaction table information for member_id ’M03‘and ’M04’.
12. Find the books of type ’CSE' and ’ECE’.
13. Find the books whose price is greater than 3500 and less than or equal to 5000.
14. Find the books that cost more than 5000 also find the new cost as original cost
multipliedby 15.
15. Rename the new column in the above query as new_price.
16. List the books in sorted order of their titles.
17. Print the names and types of all the books except IC books.
18. Calculate the square root of the price of each book.
l9. Divide the cost of book ’Digital Design” by difference between its price and 1000.
20. List the names. areas and member_id of members without phone numbers.
21. List the names of members without lname
22. List the book_id. title, type of books whose author name begin with letter ’M’.
23. List the book_id and t_id of members having t_id less than ‘t05’ from the transaction
table.

You might also like