SQL Commands For Book Details: EXP - NO:2 Date
SQL Commands For Book Details: EXP - NO:2 Date
NO:2
AIM:
p_name varchar(15),
p_address varchar(25),
primary key(p_name));
a_name varchar(10),
country varchar(25),
primary key(a_name));
isbn_no number(5),
title varchar(10),
pub_yr number(5),
price number(5),
a_name varchar(10),
p_name varchar(15),
primary key(isbn_no),
4 row(s) inserted.
4 row(s) inserted.
P_NAME P_ADDRESS
PHI Delhi
Technical Pune main bazar
Nirali Mumbai
Scitech Chennai
4 rows returned
A_NAME COUNTRY
Arora US
Kapoor Canada
Basu India
Sinha India
4 rows returned
1) a.Find all the publisher name.
P_NAME
Nirali
Technical
Scitech
PHI
Technical
5 rows returned
P_NAME
Nirali
Technical
PHI
Scitech
4 rows returned
2)Find all the details of the book.
TITLE
ADBMS
Orale
DBMS
3 rows returned
4.) Find the title of the book having price b/w 300&400.
SQL> select title from s_book where price between 300 and 400;
TITLE
Unix
Orale
DBMS
3 rows returned
5.) Find the title of the book with the author name and country published in the year 2004.
9) Find the title of the book with author name and country using tuple variable.
TITLE A_NAME
Unix Kapoor
1 rows returned
11)Select the name of the book and author anme may have a character ‘r’ or ’a’.
SQL> select title,a_name from s_book where a_name like '%r%' or a_name like '%a%';
12) Display the name of all publishers where address have the substring ‘main’.
SUM(PRICE)
1799
1 rows returned MIN(PRICE)
250
1 rows returned
AVG(PRICE)
359.8
1 rows returned
COUNT(*)
4
1 rows returned
1 row updated.
Thus the implementation of SQL queries for book details was executed
successfully and the output is verified .