Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
17 views2 pages

DB Act 3

The document outlines the creation of two SQL tables: 'books' and 'issued', along with the insertion of various book records and issued quantities. It includes several SQL queries to retrieve specific information about books based on different criteria such as publishers, price, and author names. The document serves as a guide for managing a simple library database system.

Uploaded by

prathibhabs444
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

DB Act 3

The document outlines the creation of two SQL tables: 'books' and 'issued', along with the insertion of various book records and issued quantities. It includes several SQL queries to retrieve specific information about books based on different criteria such as publishers, price, and author names. The document serves as a guide for managing a simple library database system.

Uploaded by

prathibhabs444
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

create table books (book_id varchar(10), book_name varchar(15), author_name

varchar(15), publishers varchar(10),price number, type varchar(10), quantity


number, primary key(book_id));

create table issued(b_id varchar(10), Qty_issued number, foreign key(b_id)


references books(book_id));

insert into books values('C0001','The Klone and I', 'Latha Kappor','EPP', 355,
'Novel',5);
insert into books values('F0001','The Tears', 'William Hopkins','First Publ', 650,
'Fiction',20);
insert into books values('T0001','My First C++', 'Brain Brooke','ERP', 350,
'Text',10);
insert into books values('T0002','C++ Brainsworks', 'A.W.Rossaine','TDH', 350,
'Text',15);
insert into books values('F0002','Thunderbolts', 'Ana Roberts','First Publ', 750,
'Fiction',50);

insert into issued values('T0001',4);


insert into issued values('C0001',5);
insert into issued values('F0001',2);
insert into issued values('T0002',5);
insert into issued values('F0002',8);

select * from books;


select * from issued;

QUERIES

select book_name,author_name,price from books where publishers='First Publ';

select book_id,book_name,publishers from books where quantity>8 and price<500;

select book_id,book_name,author_name from books where publishers<>'ERP' and (price


between 300 and 700);

select book_id,book_name,publishers,price,quantity,price+price*0.04 as total from


books,issued where books.book_id=issued.b_id;

select * from books where book_id in ('C0001','F0001','T0002','F0002');

select book_name from books where type<>'novel' and type<>'fiction';

select * from books where author_name like 'A%';

select * from books where author_name like 'T%S';

select book_id,book_name,author_name,qty_issued from books,issued where


books.book_id=issued.b_id;

select book_name,author_name,price from books order by book_name asc , price desc;

You might also like