Professional Documents
Culture Documents
MAdrid - John PAulFinal - 02 - INFOMgt - NationalBookStore - Case Scenario
MAdrid - John PAulFinal - 02 - INFOMgt - NationalBookStore - Case Scenario
MAdrid - John PAulFinal - 02 - INFOMgt - NationalBookStore - Case Scenario
1. For every book, list its book code, book title, publisher code, and publisher name. The list
should be alphabetically listed by book title.
ANS: select Book.BOOK_CODE,Book.BOOK_TITLE,Book.PUB_CODE,Publisher.PUB_CODE from
Book, Publisher where Book.PUB_CODE=publisher.PUB_CODE order by (BOOK_TITLE)
ANS:
Madrid John Paul B. February 14, 2020
BSIT 2 - 1
3. List the book title and book code for every book published by Bantam Books that has a book
price greater than $10 arranged by book code.
ANS: select BOOK_TITLE, BOOK_CODE from Book where PUB_CODE ='BB'and BOOK_PRICE >10
order by (BOOK_CODE)
5. List the book title of every CS book type published by Best and Furrow.
ANS: select BOOK_TITLE from Book where BOOK_TYPE ='CS'and PUB_CODE ='BF'
7. List the names of the author together with his/her corresponding publisher. The names
should be in the format Last Name, First Name e.g. Rizal, Jose
ANS: select concat(AUTHOR_LAST,', ', AUTHOR_FIRST)as AUTHOR_NAME,Publisher.PUB_NAME
from Author, Publisher, Written, Book where
Publisher.PUB_CODE=Book.PUB_CODEandBook.BOOK_CODE=Written.BOOK_CODEandWritten.AUTH
OR_NO=Author.AUTHOR_NO
Madrid John Paul B. February 14, 2020
BSIT 2 - 1
13. Permanently add the word Publishing to the Publisher’s name if the publisher is from New
York but only if the name does not have it yet. (Example: Random HousePublishing)
ANS: update Publisher set PUB_NAME =concat(PUB_NAME,' Publishing')
where PUB_CITY ='New York'and PUB_NAME notlike'%Publishing'
14. What would be the publisher’s name of the third record when you display all publishers from
New York after doing (13)?
ANS: Pocket Books Publishing
15. Permanently add the word The in the book title for those books whose title starts with S, P,
H, Y, N, or X but only for those books whose publisher is from New York. (Ex. The Castle)
ANS: update Book set BOOK_TITLE =concat('The ', BOOK_TITLE)from Publisher
where BOOK_TITLE
like'[SPHYNX]%'andBook.PUB_CODE=Publisher.PUB_CODEandPublisher.PUB_CITY='New York'
17. Generate the following report taking note of the sample output:
Book Title Publisher – Location
Cujo The Signet Publishing - New York, NY
19. Generate the following report taking note of the sample output:
Book Title Publisher Branch Number Units on Hand
Cujo The Signet Publishing 1 1
ANS: selectBook.BOOK_TITLEas'Book
Title',Publisher.PUB_NAMEas'Publisher',Inventory.BRANCH_NOas'Branch
Number',Inventory.UNITS_ON_HANDas'Units on Hand'from Book, Publisher, Inventory
where BOOK.PUB_CODE =Publisher.PUB_CODEand BOOK.BOOK_CODE =Inventory.BOOK_CODE
Madrid John Paul B. February 14, 2020
BSIT 2 - 1
0200 1 1
0200 2 3
ANS:
Make sure you wrote the SQL statements for 1, 3, 5, 7, 9, 11, 13, 15, 17, and 19 and
answers to 2, 4, 6, 8, 10, 12, 14, 16, 18 and 20.
Log off from MS SQL Server, log off from Windows, arrange the chairs, submit your
paper to the proctor, and quietly leave the room.