Question: I need example code in MYSQL: 1. Define a view named BOOK_INVENTORY. It consists of the branch number and the total number of books on

I need example code in MYSQL:

1. Define a view named BOOK_INVENTORY. It consists of the branch number and the total number of books on hand for each branch. Use UNITS as the name for the count of books on hand. Group and order the rows by branch number.

a. Write and execute the CREATE VIEW command to create the BOOK_INVENTORY view.

b. Write and execute the command to retrieve the branch number and units for each branch having more than 25 books on hand.

c. Write and execute the query that the DBMS actually executes.

d. Does updating the database through this view create any problems? If so, what are they? If not, why not?

2. Write, but do not execute, the commands to grant the following privileges:

a. User Rodriquez must be able to retrieve data from the BOOK table.

b. Users Gomez and Liston must be able to add new books and publishers to the database.

c. Users Andrews and Zimmer must be able to change the price of any book.

d. All users must be able to retrieve the book title, book code, and book price for every book.

e. User Golden must be able to add and delete publishers.

f. User Andrews must be able to create an index for the BOOK table.

g. Users Andrews and Golden must be able to change the structure of the AUTHOR table.

h. User Golden must have all privileges on the BRANCH table.

3. Write, but do not execute, the command to revoke all privileges from user Andrews.

4. Create the following indexes:

a. Create an index named BOOK_INDEX1 on the TITLE column in the BOOK table.

b. Create an index named BOOK_INDEX2 on the TYPE column in the BOOK table.

c. Create an index named BOOK_INDEX3 on the CITY and PUBLISHER_NAME columns in the PUBLISHER table.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!