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...
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?
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...
Using your downloaded DBMS (MS SQL Server), create a new database. Create the database tables based...
Using your downloaded DBMS (MS SQL Server), create a new database. Create the database tables based on your entities defining The attributes within each table The primary and foreign keys within each table *****Show your database tables, tables attributes, primary and foreign keys***** Do not forget to check the lesson slides and videos that show you how to convert an ER/EER into a database schema, and how to create a database and tables using MS SQL Server.
Create the actual database using SQL syntax. This is completed using a Database Application (i.e Microsoft...
Create the actual database using SQL syntax. This is completed using a Database Application (i.e Microsoft Access, Oracle, or MySQL) as indicated by your professor. After creating the database – populate it with some data (could be made up). SQL syntax and the DB application will be discussed and taught in class. This is the final deliverable of the group project. Assignment is due by the due date as indicated by your professor. *Make sure to submit the completed database...
Please write the SQL statement for the following. I am using the Adventurework2014 database. 1. Create...
Please write the SQL statement for the following. I am using the Adventurework2014 database. 1. Create a login for AdventureWorks employees. An employee login should be composed of the first letter of a person's first name combined with their last name. In addition, the login should be all lower case characters. All the required information is located in Person.Person table. Employees can be identified by "EM" value in the PersonType field. The output should include BusinessEntityID, first name (FirstName), last...
Database - SQL - Operations CS 203 Discrete Structure 2 Create a Microsoft Access Database consisting...
Database - SQL - Operations CS 203 Discrete Structure 2 Create a Microsoft Access Database consisting of the following two tables: Part_needs and Parts_Inventory Part_needs Supplier Part_number Project 23 1092 1 23 1101 3 23 9048 4 31 4975 3 31 3477 2 32 6984 4 32 9191 2 33 1001 1 Parts_Inventory Part_number Project Quantity Color_code 1001 1 14 8 1092 1 2 2 1101 3 1 1 3477 2 25 2 4975 3 6 2 6984 4 10...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT