Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i wand draw erd for tihse system Entities: 1 . Book 2 . Author 3 . Publisher 4 . Genre 5 . Customer 6 .

i wand draw erd for tihse system
Entities:
1. Book
2. Author
3. Publisher
4. Genre
5. Customer
6. Order
Relationships:
1. An Author can write multiple Books (One-to-Many)
2. A Book is written by one Author (Many-to-One)
3. A Book is published by one Publisher (Many-to-One)
4. A Publisher can publish multiple Books (One-to-Many)
5. A Book can belong to multiple Genres (Many-to-Many)
6. A Genre can have multiple Books (Many-to-Many)
7. A Customer can place multiple Orders (One-to-Many)
8. An Order can contain multiple Books (One-to-Many)
9. A Book can be included in multiple Orders (Many-to-Many)
10. An Order is placed by one Customer (Many-to-One)
Logical Design: SQL Coding
-- Book table
CREATE TABLE Book (
book_id INT PRIMARY KEY,
title VARCHAR(255),
isbn VARCHAR(20),
publisher_id INT,
FOREIGN KEY (publisher_id) REFERENCES Publisher(publisher_id)
);
-- Author table
CREATE TABLE Author (
author_id INT PRIMARY KEY,
name VARCHAR(100)
);
-- Publisher table
CREATE TABLE Publisher (
publisher_id INT PRIMARY KEY,
name VARCHAR(100)
);
-- Genre table
CREATE TABLE Genre (
genre_id INT PRIMARY KEY,
name VARCHAR(100)
);
-- Customer table
CREATE TABLE Customer (
customer_id INT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(255),
address VARCHAR(255)
);
-- Order table
CREATE TABLE Order (
order_id INT PRIMARY KEY,
customer_id INT,
order_date TIMESTAMP,
FOREIGN KEY (customer_id) REFERENCES Customer(customer_id)
);
-- Book_Genre table for many-to-many relationship between Book and Genre
CREATE TABLE Book_Genre (
book_id INT,
genre_id INT,
PRIMARY KEY (book_id, genre_id),
FOREIGN KEY (book_id) REFERENCES Book(book_id),
FOREIGN KEY (genre_id) REFERENCES Genre(genre_id)
);
-- Order_Item table to represent the many-to-many relationship between Order and Book
CREATE TABLE Order_Item (
order_id INT,
book_id INT,
quantity INT,
PRIMARY KEY (order_id, book_id),
FOREIGN KEY (order_id) REFERENCES Order(order_id),
FOREIGN KEY (book_id) REFERENCES Book(book_id)
);
-- Author_Book table to represent the many-to-many relationship between Author and Book
CREATE TABLE Author_Book (
author_id INT,
book_id INT,
PRIMARY KEY (author_id, book_id),
FOREIGN KEY (author_id) REFERENCES Author(author_id),
FOREIGN KEY (book_id) REFERENCES Book(book_id)
);
The Book table stores information about books, including their title, ISBN, and the publisher they belong to.
The Author table stores information about authors, including their name.
The Publisher table stores information about publishers, including their name.
The Genre table stores information about book genres, including their name.
The Customer table stores information about customers, including their name, email, and address.
The Order table stores information about orders placed by customers, including the order date.
The Book_Genre table represents the many-to-many relationship between books and genres.
The Order_Item table represents the many-to-many relationship between orders and books.
The Author_Book table represents the many-to-many relationship between authors and books.

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

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions

Question

What is job rotation ?

Answered: 1 week ago

Question

Explain the importance of nonverbal messages.

Answered: 1 week ago

Question

Describe the advantages of effective listening.

Answered: 1 week ago

Question

Prepare an employment application.

Answered: 1 week ago