Create a small book database that has the following relational schemas: author(a
ID: 3640982 • Letter: C
Question
Create a small book database that has the following relational schemas:author(author_id, author_name);
book( isbn_ number, title);
auth_book (author_id, isbn_ number);
Enter data into the tables. Create at least two authors that are not related to any books and at least one book that has no author.
Write a query using the outer join idea that lists the name of authors who have not authored any books.
I am sorry, please I study little on the database, so I can provide more details, please set some instances, and provide a answer as detailed as possible.
Explanation / Answer
The following queries are executed in oracle DB, so by default database will be XE -- 3 tables created Create table author(author_id number , author_name varchar2(5)); Create table book(isbn_number number , title varchar2(5)); Create table auth_book (author_id number , isbn_number number); -- Insert following values to 3 tables Insert into author (author_id, author_name) values (1, 'aut1') Insert into author (author_id, author_name) values (2, 'aut2') Insert into author (author_id, author_name) values (3, 'aut3') Insert into author (author_id, author_name) values (4, 'aut4') Insert into author (author_id, author_name) values (5, 'aut5') Insert into book(isbn_number,title ) values (1111,'book1') Insert into book(isbn_number,title ) values (2222,'book2') Insert into book(isbn_number,title ) values (3333,'book3') Insert into book(isbn_number,title ) values (4444,'book4') Insert into book(isbn_number,title ) values (5555,'book5') Insert into auth_book (author_id, isbn_number) values (1,1111) Insert into auth_book (author_id, isbn_number) values (2,2222) Insert into auth_book (author_id, isbn_number) values (3,3333) -- Run following query which displays --Authors who have not authored any book. -- Author_ID 4 and 5 have not authored any book Select author.author_id, author.author_name, book.isbn_number, book.title as book_title from author left outer join auth_book on author.author_id = auth_book.author_id left outer Join book on book.isbn_number = auth_book.isbn_number Hope this helps and desired result is outputted, Please rate.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.