Question

In: Computer Science

Use the following information to create SQL commands to retrieve data from Henry Books database :...

Use the following information to create SQL commands to retrieve data from Henry Books database :

For each book, list the book code, book title, publisher code, and publisher name. Order the results by publisher name.
For each book published by Plume, list the book code, book title, and price.
List the book title, book code, and price of each book published by Plume that has a book price of at least $14.
List the book code, book title, and units on hand for each book in branch number 4.
List the book title for each book that has the type PSY and that is published by Jove Publications.
Find the book code and book title for each book located in branch number 2 and written by author 20.
Find the book title, author last name, and units on hand for each book in branch number 4.
Repeat Exercise 7, but this time list only paperback books.
Find the book code and book title for each book whose price is more than $10 or that was published in Boston.
Find the book code and book title for each book whose price is more than $10 and that was published in Boston.
Find the book code and book title for each book whose price is more than $10 but that was not published in Boston.

Solutions

Expert Solution

For each book, list the book code, book title, publisher code, and publisher name. Order the results by publisher name.

select b.book_code,b.title,b.publisher_code,p.publisher_name from book as b,publisher as p where p.publisher_code=b.publisher_code order by p.publisher_name

For each book published by Plume, list the book code, book title, and price.

select b.book_code,b.title,b.price from book as b, publisher as p where p.publisher_code=b.publisher_code and p.publisher_name='Plume'

List the book title, book code, and price of each book published by Plume that has a book price of at least $14.

select b.book_code,b.title,b.price from book as b, publisher as p where p.publisher_code=b.publisher_code and p.publisher_name='Plume' and b.price>=14

List the book code, book title, and units on hand for each book in branch number 4.

select b.book_code,b.title,i.on_hand from book as b, inventory as i,branch as br where b.book_code=i.book_code and i.branch_num=br.branch_num and i.branch_num=4

List the book title for each book that has the type PSY and that is published by Jove Publications.

select b.title from book as b, publisher as p where p.publisher_code=b.publisher_code and p.publisher_name='Jove Publications' and b.type='PSY'

Find the book code and book title for each book located in branch number 2 and written by author 20.

select b.book_code,b.title from book as b,copy as c,wrote as w where b.book_code=c.book_code and b.book_code=w.book_code and w.author_num=20 and c.branch_num=2

Find the book title, author last name, and units on hand for each book in branch number 4.

select b.book_title,a.author_last, i.on_hand from book as b,wrote as w, inventory as i, author as a where b.book_code=w.book_code and b.book_code=i.book_code and a.author_num=w.author_num and i.branch_num=4

Repeat Exercise 7, but this time list only paperback books.

select b.book_title,a.author_lastname, i.on_hand from book as b,wrote as w, inventory as i, author as a where b.book_code=w.book_code and b.book_code=i.book_code and a.author_num=w.author_num and i.branch_num=4 and b.paperback='Y'

Find the book code and book title for each book whose price is more than $10 or that was published in Boston.

select b.book_code,b.title from book as b,publisher as p where p.publisher_code=b.publisher_code and b.price>10 or p.city='Boston'

Find the book code and book title for each book whose price is more than $10 and that was published in Boston.

select b.book_code,b.title from book as b,publisher as p where p.publisher_code=b.publisher_code and b.price>10 and p.city='Boston'

Find the book code and book title for each book whose price is more than $10 but that was not published in Boston.

select b.book_code,b.title from book as b,publisher as p where p.publisher_code=b.publisher_code and b.price>10 and p.city<>'Boston'

Related Solutions

Please use the books database pasted under question 4 to design the following SQL queries. Use...
Please use the books database pasted under question 4 to design the following SQL queries. Use any method such as subqueries, equi-join/inner-join, outer join, EXISTS 1. Find the name(s) of the publisher(s) who have published the computer book. 2. Find the name(s) of the author(s) that have authored more than one books. 3. Find the name(s) of the publisher(s) who published the least expensive book. 4. Find the name(s) of the author(s) who wrote the book with the greatest number...
Please use the books database pasted under question 4 to design the following SQL queries. Use...
Please use the books database pasted under question 4 to design the following SQL queries. Use any method such as subqueries, equi-join/inner-join, outer join, EXISTS 1. List the title_name and book type of the books that are published earlier than the earliest biography book 2. List the title_name and book type of the books published by 'Abatis Publishers' 3. Find the name(s) of the publisher(s) that have not published any book 4. Find the name(s) of the publisher(s) who have...
Create a PL/SQL block to retrieve and display data for all pledges made in a specified...
Create a PL/SQL block to retrieve and display data for all pledges made in a specified month. One row of output should be displayed for each pledge. Include the following in each row of output:    - Pledge ID, donor ID, and Pledge Amount - If the pledge is being paid in a lump sum, display "LUMP SUM". - If the pledge is being paid in monthly payments, display "Monthly - #" (With the # representing the number of months...
Using SQL Developer Question 1 Create a block to retrieve and display pledge and payment information...
Using SQL Developer Question 1 Create a block to retrieve and display pledge and payment information for a specific donor. For each pledge payment from the donor, display the pledge ID, pledge amount, number of monthly payments, payment date, and payment amount. The list should be sorted by pledge ID and then by payment date. For the first payment made for each pledge, display “first payment” on that output row. Question 2 Redo question 1, but use a different cursor...
Need SQL commands for these questions based on the bowling league database; When was the first...
Need SQL commands for these questions based on the bowling league database; When was the first tournament date and where was it played? What are the number of tournaments per location?
Use adventure works 2014 database to solve the following questions in SQL management studio. 1. Create...
Use adventure works 2014 database to solve the following questions in SQL management studio. 1. Create a stored procedure that will receive parameters (all non-nullable fields should be supplied except the primary key which should be auto created still) to add a customer, single email, and single phone. The procedure should run it's code in a transaction and if any part of the add fails then the transaction should rollback. 2. Provide this query from previous assignments written with an...
Database questions: USE THE FOLLOWING SQL CODE TO SOLVE NEXT QUESTIONS: CREATE TABLE ROBOT ( Serial_no...
Database questions: USE THE FOLLOWING SQL CODE TO SOLVE NEXT QUESTIONS: CREATE TABLE ROBOT ( Serial_no INT NOT NULL, Model VARCHAR(20) NOT NULL, Manufacturer VARCHAR(20) NOT NULL, Price INT NOT NULL, PRIMARY KEY (Serial_no) ); INSERT INTO ROBOT VALUES (1, 'Scara','Epson', 23200); INSERT INTO ROBOT VALUES (2, 'ASSISTA','Mitsubishi', 17500); INSERT INTO ROBOT VALUES (3, 'Lego Mindstorm','NXT', 650); INSERT INTO ROBOT VALUES (4, 'Yumi','ABB', 40000); INSERT INTO ROBOT VALUES (5, 'Pepper','Foxconn', 1600); INSERT INTO ROBOT VALUES (6, 'Humanoid','Honda', 30000); SELECT *...
Information on the following Database: create database Sales_Co use Sales_Co create table Vendor (v_code integer, v_name...
Information on the following Database: create database Sales_Co use Sales_Co create table Vendor (v_code integer, v_name varchar(35) not null, v_contact varchar(15) not null, v_areacode char(3) not null, v_phone char(8) not null, v_state char(2) not null, v_order char(1) not null, primary key (v_code)); create table product (p_code varchar(10) constraint product_p_code_pk primary key, p_descript varchar(35) not null, p_indate datetime not null, p_qoh integer not null, p_min integer not null, p_price numeric (8,2) not null, p_discount numeric (4,2) not null, v_code integer, constraint...
Create three MySQL database tables and write SQL scripts to read, insert, and delete data. The...
Create three MySQL database tables and write SQL scripts to read, insert, and delete data. The first database table will contain the names of at least four movies. The second table will be a list of actors who appear in the movies. The third table will be an associative table that describes the relationship between the actors and their movies (which actors appear in which movies). Actors and movies have a “many-to-many relationship,” meaning an actor can be in multiple...
Create three MySQL database tables and write SQL scripts to read, insert, and delete data. The...
Create three MySQL database tables and write SQL scripts to read, insert, and delete data. The first database table will contain the names of at least four movies. The second table will be a list of actors who appear in the movies. The third table will be an associative table that describes the relationship between the actors and their movies (which actors appear in which movies). Actors and movies have a “many-to-many relationship,” meaning an actor can be in multiple...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT