Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For each question component below: Write appropriate SQL code. In your answer do

ID: 3824540 • Letter: F

Question

For each question component below:

Write appropriate SQL code.

In your answer document, include a screenshot that displays your SQL code & the results of the execution of the SQL code for question 1.

Running and execution of queries in workspace is not required for question 2. Providing SQL codes (Text) is enough for this question.

Question 1

Create a VIEW with the name BOOK_VC that includes only book titles (BK_TITLE) for books whose list price is more than $150. (20)

Create a VIEW with the name PUBLISHER_VC that includes name, zip code and phone number of publishers who has never published a book whose list price is less than $100. (30)

Create a VIEW with the name AUTHOR_VC that includes name of each author born after January 18, 1976. (20)

Question 2

Grant SELECT & DELETE permission on the BOOK_VC view to the user MOJA. (10)

Grant UPDATE permission on the PB_NAME & PB_ZIPCODE columns of the PUBLISHER_VC view to the user MBILI such that PB_PHONE_NUMBER = 1023489823. (10)

Grant SELECT, INSERT, UPDATE & DELETE permission on the AUTHOR_VC view to all users. (10)

Explanation / Answer

1.

create view BOOK_VC as
select BK_TITLE from books where list_price > 150.

create view PUBLISHER_VC as
select name,zip_code,phone_number
from publisher where price_list < 100


create view AUTHOR_VC as
select name from author
where DOB > tochar(18-01-1976 , dd-mm-yyyy);


2.

GRANT SELECT | DELETE ON
BOOK_VC TO MOJA.


GRANT UPDATE ON PB_NAME.PUBLISHER,PB_ZIPCODE.PUBLISHER
TO MBILI


GRANT ALL ON AUTHOR_VC
TO ALL.