Question: My answer is not correct, can you help on this, please. Consider the following schema: Publisher (name, phone, city), PK: name. Book (ISBN, title, year,
My answer is not correct, can you help on this, please.
Consider the following schema:
Publisher (name, phone, city), PK: name.
Book (ISBN, title, year, published_by, previous_edition, price), PK: ISBN, FK: published_by refs Publisher, previous_edition refs Book.
Author (SSN, first_name, last_name, address, income), PK: SSN.
Write (aSSN, bISBN), PK: (aSSN, bISBN), FK: aSSN refs Author, bISBN refs Book.
Editor (SSN, first_name, last_name, address, salary, works_for, book_count), PK: SSN, FK: works_for refs Publisher.
Edit (eSSN, bISBN), PK: (eSSN, bISBN), FK: eSSN refs Editor, bISBN refs Book.
Author_Editor (aeSSN, hours), PK: aeSSN, FK: aeSSN refs Author, aeSSN refs Editor.
Give SQL statements for the following plain English language queries based on the above schema.
3. Provide the first name and last name of every author-editor who edits at least one book that is written by him or herself. (15 pts)
Ans:
select Author.first_name, Author.last_name from Author join Author_Editor on Author_Editor.aessn = Author.ssn join Edits on Edits.essn = Author_Editor.aessn where Edits.essn = Author_Editor.aessn;
5. Provide the first name and the last name of those editors who have edited all the books written by John Smith. (5 pts)
Ans:
select Editor.first_name, Editor.last_name from Editor where ssn in (select Author.ssn from Author where Author.first_name = 'john' and Author.last_name = 'smith');
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
