Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in SQL BookAuthor (book, year, author, earnings) BookReference (book, year, referencedBook, referencedYear, times) BookReview(book, year, reviewer, score) BookPublish(book, year, publisher, price, num) Assume that each

image text in transcribedin SQL

BookAuthor (book, year, author, earnings) BookReference (book, year, referencedBook, referencedYear, times) BookReview(book, year, reviewer, score) BookPublish(book, year, publisher, price, num) Assume that each book may have one or more authors and each author may make a different amount of money from that book. One book may make reference to other books. One book may be reviewed by different reviewers and get different scores. An author could also be a reviewer and a publisher. Books with the same name but published in different years are considered different books. write SQL schema definitions (CREATE TABLE ) statements for these relations in SQL, with the following constraints. Use attribute-based checks, tuple-based checks, foreign key declarations, or SQL assertions, as appropriate. a) All books that appear anywhere in this database must appear in the relation b) A book cannot reference a book published in a future year. Neither can it reference itself. c) Revenues from a book (price times number of copies) must be at least twice the authors' total earnings for that book. No reviewer may review more than 20 books published in the same year. be at least 8, unless there is no review for this book. d) e) If a book is referenced by more than 20 other books, then its average review score must BookAuthor (book, year, author, earnings) BookReference (book, year, referencedBook, referencedYear, times) BookReview(book, year, reviewer, score) BookPublish(book, year, publisher, price, num) Assume that each book may have one or more authors and each author may make a different amount of money from that book. One book may make reference to other books. One book may be reviewed by different reviewers and get different scores. An author could also be a reviewer and a publisher. Books with the same name but published in different years are considered different books. write SQL schema definitions (CREATE TABLE ) statements for these relations in SQL, with the following constraints. Use attribute-based checks, tuple-based checks, foreign key declarations, or SQL assertions, as appropriate. a) All books that appear anywhere in this database must appear in the relation b) A book cannot reference a book published in a future year. Neither can it reference itself. c) Revenues from a book (price times number of copies) must be at least twice the authors' total earnings for that book. No reviewer may review more than 20 books published in the same year. be at least 8, unless there is no review for this book. d) e) If a book is referenced by more than 20 other books, then its average review score must

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions