SQL Henry Books Solutions

March 25, 2018 | Author: nicadagle1996 | Category: John Steinbeck, Harry Potter, Novels, Leisure


Comments



Description

1. List the name of each publisher that's not located in New York.mysql> select PublisherName from Publisher -> where City != "New York" +--------------------+ | PublisherName | +--------------------+ | Arkham House | | Basic Books | | Berkley Publishing | | Course Technology | | Jeremy P. Tarcher | | McPherson and Co. | | Taunton Press | | Touchstone Books | | Westview Press | +--------------------+ 9 rows in set (0.00 sec) 2. List the title of each book published by Penguin USA. select Title from Book, Publisher where Book.PublisherCode = Publisher.PublisherCode and PublisherName = "Penguin USA" +----------------------+ | Title | +----------------------+ | Of Mice and Men | | Travels with Charley | | East of Eden | | The Grapes of Wrath | +----------------------+ 4 rows in set (0.00 sec) 3. List the title of each book that has the type MYS. mysql> select Title from Book -> where Type = "MYS"; +-------------+ | Title | +-------------+ | Second Wind | | The Edge | | Slay Ride | +-------------+ 3 rows in set (0.00 sec) 4. List the title of each book that has the type SFI and that is in paperback. HIS. +---------------------------------------+ | Title | +---------------------------------------+ | The Edge | | Group: Six People in Search of a Life | | When Rabbit Howls | | Slay Ride | +---------------------------------------+ 4 rows in set (0.00 sec) . How many books have a publisher code of ST or VB? select count(*) as BooksPubSTorVB from Book where PublisherCode = "ST" or PublisherCode = "VB" +----------------+ | BooksPubSTorVB | +----------------+ | 4 | +----------------+ 1 row in set (0. List the title of each book that has the type PSY or whose publisher code is JP.00 sec) 6.select Title from Book where Type = "PSY" and Paperback = "Yes" +---------------------------------------+ | Title | +---------------------------------------+ | Group: Six People in Search of a Life | | When Rabbit Howls | +---------------------------------------+ 2 rows in set (0.01 sec) 5. select Title from Book where Type = "CMP" or Type = "HIS" or Type = "SCI" +---------------------------+ | Title | +---------------------------+ | The Soul of a New Machine | | Band of Brothers | | A Guide to SQL | +---------------------------+ 3 rows in set (0. mysql> select Title from Book -> where Type = "PSY" or PublisherCode = "JP".00 sec) 7. or SCI. List the title of each book that has the type CMP. publisher code.AuthorNum and AuthorLast = "Steinbeck" and AuthorFirst = "John" and Type = "FIC" +---------------------+ | Title | +---------------------+ | Of Mice and Men | | East of Eden | | The Grapes of Wrath | +---------------------+ 3 rows in set (0.BookCode and Wrote.AuthorNum and AuthorLast = "Francis" and AuthorFirst = "Dick" +-------------+ | Title | +-------------+ | Second Wind | | The Edge | | Slay Ride | +-------------+ 3 rows in set (0.AuthorNum = Wrote. type.00 sec) 10. and author names (in the order listed on the cover). Type from Author.00 sec) 9. Wrote.AuthorNum = Wrote.BookCode = Wrote.BookCode and Author. List the title of each book written by Dick Francis. ". For each book with coauthors. Author. Title.BookCode and Author.BookCode. List the title of each book that has the type FIC and that was written by John Steinbeck. list the title. +-----------------------+-----------------------------------------+---------------+------+ | Author | Title | PublisherCode | Type | . Wrote where Book. Book where Author. PublisherCode.BookCode in ( select BookCode from Wrote group by BookCode having Count(*) >= 2 ) order by Wrote.8.AuthorNum = Wrote. AuthorFirst) as Author. Sequence asc. Wrote where Book. select Title from Book. Author.".BookCode = Wrote.BookCode = Wrote. select concat(AuthorLast.AuthorNum and Book. select Title from Book. BookCode = Copy. Quality.BookCode . quality. copy number. copy number. List the branch number.00 sec) 13..01 sec) ST ST WP WP RH RH 11. select BranchName. quality. CopyNum. Peter | Black House | | HOR | +-----------------------+-----------------------------------------+---------------+------+ 6 rows in set (0. mysql> select BranchNum. Price from Copy. How many book copies have a price that is greater than $20 but less than $25? select count(*) as Book20to25 from Copy where Price > 20 and Price < 25 +------------+ | Book20to25 | +------------+ | 6 | +------------+ 1 row in set (0. +-----------+---------+-----------+-------+ | BranchNum | CopyNum | Quality | Price | +-----------+---------+-----------+-------+ | 1 | 1 | Excellent | 8 | | 2 | 1 | Excellent | 8 | | 2 | 2 | Fair | 4 | | 2 | 3 | Poor | 2 | +-----------+---------+-----------+-------+ 4 rows in set (0. | Harry Potter and the Prisoner of Azkaban | | SFI | | Collins.BookCode = Copy. Quality. Branch where Book. Jr.00 sec) 12. Price from Copy.+-----------------------+-----------------------------------------+---------------+------+ | Morrison.BookCode -> and Title = "The Stranger". J. List the branch name. Book. Toni | Harry Potter and the Prisoner of Azkaban | | SFI | | Rowling. CopyNum. Bradley | Van Gogh and Gauguin | | ART | | King. Stephen | Black House | | HOR | | Straub.K. Book -> where Book. Bradley | Van Gogh and Gauguin | | ART | | Collins. and price for each copy of Electric Light. and price for each copy of The Stranger. BookCode and Wrote.00 sec) 15.AuthorNum = Wrote. Sequence asc +------------------------------------------+------------------------+ | Excellent Books at Henry on the Hill | Author | +------------------------------------------+------------------------+ | A Deepness in the Sky | Vintage. ". Book where Author. For each book copy available at the Henry on the Hill branch whose quality is excellent.00 sec) 14. Price from Book.and Branch. list the book's title. concat(AuthorLast.BookCode -> and Price > 25.BookCode in (select Wrote. list the book's title and author names (in the order listed on the cover).BranchNum group by Wrote. select Title as "Excellent Books at Henry on the Hill". Copy -> where Book. and price.AuthorNum and Book. ".BranchNum = Branch. mysql> select Title. Wrote where BranchName = "Henry on the Hill" and Quality = "Excellent" and Copy. +-----------------+-----------+-------+ | Title | Quality | Price | +-----------------+-----------+-------+ | Second Wind | Excellent | 26 | | Second Wind | Excellent | 26 | | Second Wind | Excellent | 26 | | Second Wind | Excellent | 26 | | Treasure Chests | Good | 35 | | A Guide to SQL | Excellent | 40 | | A Guide to SQL | Excellent | 40 | +-----------------+-----------+-------+ 7 rows in set (0. Vernor | . Quality.BookCode.BookCode = Wrote. quality.BranchNum = Copy. For each book copy with a price greater than $25.BranchNum and Title = "Electric Light" +-----------------+---------+-----------+-------+ | BranchName | CopyNum | Quality | Price | +-----------------+---------+-----------+-------+ | Henry Downtown | 1 | Excellent | 15 | | Henry Downtown | 2 | Excellent | 15 | | Henry Downtown | 3 | Good | 9 | | Henry Eastshore | 1 | Good | 9 | +-----------------+---------+-----------+-------+ 4 rows in set (0.BookCode from Branch.AuthorFirst) as Author from Author. Copy. Wrote.BookCode) order by Wrote.BookCode = Copy. 05 sec) . | | The Soul of a New Machine | Kidder. John | | Catch-22 | Heller. J. Joseph | | Jazz | Morrison. | | Harry Potter and the Prisoner of Azkaban | Morrison. John | | Harry Potter and the Goblet of Fire | Rowling.Rourke.D. J. Stephen | | Treasure Chests | O. Harper | +------------------------------------------+------------------------+ 36 rows in set (0. Douglas R. Albert | | Venice | Wills. J. Randy | | Beloved | Schleining. | | The Fall | Camus. Seamus | | Group: Six People in Search of a Life | Solotaroff. Toni | | Van Gogh and Gauguin | Collins.D. Dick | | The Catcher in the Rye | Salinger. Bradley | | Of Mice and Men | Steinbeck. Dick | | Dreamcatcher: A Novel | King. Peter | | The Stranger | Camus. Paul | | Nine Stories | Salinger. Toni | | Band of Brothers | Ambrose. Dick | | The Edge | Francis. Tracy | | Travels with Charley | Steinbeck. Gary | | Second Wind | Francis. John | | Slay Ride | Francis. | | To Kill a Mockingbird | Lee. | | A Guide to SQL | Pratt. John | | Electric Light | Heaney. Bradley | | Van Gogh and Gauguin | Collins. Stephen | | Black House | Straub. Truddi | | Black House | King.K. Peter | | Song of Solomon | Morrison. Bach | Hofstadter. Escher. Jr.. Lon | | Harry Potter and the Prisoner of Azkaban | Rowling.D. J. | | When Rabbit Howls | Chase.K. Albert | | Godel. Philip | | Franny and Zooey | Salinger. | | East of Eden | Steinbeck.| Magic Terror | Straub. Toni | | The Grapes of Wrath | Steinbeck. Stephen E. J.
Copyright © 2024 DOKUMEN.SITE Inc.