Question

create a database, and create tables with the following requirements: 1) The physical data model is...

create a database, and create tables with the following requirements: 1) The physical data model is about the book tracking system with the following objects: Book Publisher Author Store 2) Relationship Different to last week assignment, the changes in the relationship are: Book and publisher have a many to many relationship Book and author have a many to many relationship 3) Change the physical data model of last to account to the many to many relationship using: Junction tables Foreign keys 4) Write DDL queries for table creation and table alteration 5) Write DML queries for data insertion Add 4-6 records in each table/entity 6) Document all these steps in an APA word document Describe how you refine the physical data model Include the refined physical data model Include the DDL Queries statement Include the DML Queries statement Include the screen shot end results (tables and columns) of tables as it shown in the SSMS

0 0
Add a comment Improve this question Transcribed image text
Answer #1

(1.) The name of the database will be Book tracking system,the database consist of tables-- Book, Publisher, Author, Store. in which BookID is the primary key of Book table, similarly PublisherID is the primary key of Publisher table, AuthorID for Author table and StoreID for Store table and BookID is also refered as the foreign key for the Publisher, Author, and Store table.

Where the relational schema of these tables are as follows:- Book (BookID, BookName, Type, Rate) Publisher (BookID, PublisherID, PublisherName, YearofPublish) Author (BookID, AuthorID, AuthorName) Store (BookID, StoreID, StoreName, Address)

Following are the relationship among the different entities of the given database which are following:- 1. Publisher publish the Books 2. Author writes the Book 3. Store sells the Books  

(2) The relationship of the entities are also describe in terms of the cardinality ratio which are following:- a. A Book can be publish by many Publishers and similarly a publisher can publish many Books b. Similarly a book can be written by many Author and a Author can write

(3.) Since the relation Book-Author and Book-Publisher has many to many relation there when we convert the ER- diagram into the equivalent tables then the along with table Author and Book a new table will be created (let say BookAuthorInfo) which will contain the primary key of both the table (that is BookID and AuthorID) this new table is called junction table, similar to Author-Book relation, for Book-Publisher table also a new table will be created (let say BookPublisherInfo) which will contain the primary key of both the table (that is BookID and PublisherID)

(4) DDL command in MYSQL to create table and add new table in exixting database:- CREATE DATABASE BookTrackingSystem;  

CREATE TABLE Book (
BookID int(10) NOT NULL,
BookName varchar(50) ,
Type varchar(20),
Rate int(4),
    PRIMARY KEY (BookID)
);

CREATE TABLE Publisher (
PublisherID int(10) NOT NULL,
PublisherName varchar(50),
BookID int(10), YearofPublish date(dd/mm/yyyy);
    PRIMARY KEY (PublisherID),
    FOREIGN KEY (BookID) REFERENCES Book(BookID)
);

CREATE TABLE Author(
AuthorID int(10) NOT NULL,
AuthorName varchar(50),
BookID int(10),
    PRIMARY KEY (AuthorID),
    FOREIGN KEY (BookID) REFERENCES Book(BookID)
);

CREATE TABLE Store (
StoreID int(10) NOT NULL,
StoreName varchar(50),
BookID int(10), Address varchar(100),
    PRIMARY KEY (StoreID),
    FOREIGN KEY (BookID) REFERENCES Book(BookID)
);

CREATE TABLE BookAuthorInfo (
AuthorID int(10),
BookID int(10),
  FOREIGN KEY (BookID) REFERENCES Book(BookID),
    FOREIGN KEY (AuthorID) REFERENCES Author(AuthorID)
);

CREATE TABLE BookPublisherInfo (
PublisherID int(10),
BookID int(10),
  FOREIGN KEY (BookID) REFERENCES Book(BookID),
    FOREIGN KEY (PublisherID) REFERENCES Publisher(PublisherID)
);

(5.) Sql query to insert data into existing tables:-

INSERT INTO Book VALUES (123,RD sharma, Maths, 500); INSERT INTO Book VALUES (121,RS Agrawal, Maths, 300); INSERT INTO Book VALUES (112,S.Chand, Economics, 250); INSERT INTO Book VALUES (021,Morris Manno, Computer, 550);

INSERT INTO Publisher VALUES (121, 989, Dharma, "12/07/2015"); INSERT INTO Publisher VALUES (123, 956, Dennis, "21/08/2012"); INSERT INTO Publisher VALUES (112, 944, D Publication, "2/07/2011"); INSERT INTO Publisher VALUES (021, 912, jalsa, "3/03/2017");

INSERT INTO Author VALUES (121, 554, Lewis); INSERT INTO Author VALUES (123, 567, J.chand,); INSERT INTO Author VALUES (112, 555, Dhillo);    INSERT INTO Author VALUES (021, 501, Amithabh);

INSERT INTO Store VALUES (123,332, Pustak, 5 jayantipur); INSERT INTO Store VALUES (121,231, Book centre, 31/2 johnpur); INSERT INTO Store VALUES (112,233, Book kendra, 25C strret road); INSERT INTO Store VALUES (021,123, Bookspot, 78/A noman);

INSERT INTO BookAuthorInfo VALUES (123,554); INSERT INTO BookAuthorInfo VALUES (121,501); INSERT INTO BookAuthorInfo VALUES (112,555); INSERT INTO BookAuthorInfo VALUES (021,501);

INSERT INTO BookPublishernfo VALUES (123,944); INSERT INTO BookPublishernfo VALUES (121,956); INSERT INTO BookPublishernfo VALUES (112,944); INSERT INTO BookPublishernfo VALUES (021,912);

These are the sql queries which are according to the given problem statement and hence when we run these queries we will get the 6 different tables along with 4 records   

Add a comment
Know the answer?
Add Answer to:
create a database, and create tables with the following requirements: 1) The physical data model is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Assignment 3.2 - Data Modeling in Action Develop a conceptual and logical model for a book...

    Assignment 3.2 - Data Modeling in Action Develop a conceptual and logical model for a book tracking system with the following requirements: Use Microsoft Visio (available on the Sullivan VDI – https://desktop.sullivan.edu) or Lucidchart Create a conceptual data model Create a logical data model The data model is about a book tracking system with the following objects: Book Publisher Author Store Relationships: A book can have one or many publisher A book can have one or many author A book...

  • The assignment requires reading and understanding the data model used by Cassandra and representing a given ER model with Cassandra “tables”. The decision of which tables to define is driven by the qu...

    The assignment requires reading and understanding the data model used by Cassandra and representing a given ER model with Cassandra “tables”. The decision of which tables to define is driven by the queries that need to be answered. A software company is interested in developing a Video Sharing application. They have designed a conceptual model of the data they need to handle in order to offer users these main functions: 1. The creation of channels where they can upload videos....

  • Topic: Inventory Manangement Part A. Database Creation Your database should have a minimum of 4 tables...

    Topic: Inventory Manangement Part A. Database Creation Your database should have a minimum of 4 tables and include both one-to-many and many-to-many relationships. Be sure to include some numeric and/or date fields. Define all appropriate constraints, using the proper naming conventions (see Structure Notes below). Populate your database with at least 30 records in the main table(s), and whatever is needed in related tables. Submit the following: • a short description of the purpose of the database and what the...

  • Describe briefly a database application case of your choice and represent your data in terms of...

    Describe briefly a database application case of your choice and represent your data in terms of 3 linked (via foreign key/s) tables. List their respective primary key and foreign key/s if any. Your database application case should be different from those already covered in the lectures or practicals. For the database case in the Additional Exercises of the previous practical, complete the proper construction of all the 5 tables in SQL, building all the pertinent primary and foreign keys there....

  • Consider an ABC digital library that manages technical books, the data requirements are summarized as follows:...

    Consider an ABC digital library that manages technical books, the data requirements are summarized as follows: A book is identified by its ISBN number, and it has a title, a price, and a date of publication. It is published by a publisher, which has its own ID number and a name. Each book has exactly one publisher, but one publisher typically publishes multiple books over time. A book is written by one or multiple authors. Each author is identified by...

  • Problem 1. Please create the following tables for UMBC bookstore’s textbook management system with appropriate primary...

    Problem 1. Please create the following tables for UMBC bookstore’s textbook management system with appropriate primary keys & foreign keys. Please include drop table statements with cascade constraints before your create table statements so it is easier to grade your create table statements. E.g., suppose you will create table tab1, tab2, including the following before creating them: Drop table tab1 cascade constraints; Drop table tab2 cascade constraints; Assumptions: Each teacher can teach one or more scheduled course sections. Each scheduled...

  • Use MySQL Workbench to create a simple ER model and use the Forward Engineering functionality of...

    Use MySQL Workbench to create a simple ER model and use the Forward Engineering functionality of Workbench to create a simple DB (specs follow). This focuses on how MySQL Workbench is used to create a model and then a DB from it, rather than on ER modeling. The sample model you are to create is on books, authors, and publishers - a model that could be part of a larger ER model for a library. A book has an ISBN...

  • SQL QUERIES 1) Using the Product and PC relations, create both tables in your database and...

    SQL QUERIES 1) Using the Product and PC relations, create both tables in your database and insert all the data. Show the SQL statements to create each table and show a representative SQL insert statement for the data in each table (i.e. you do not need to show insert statements for all the data). – For the remaining questions, assume that your SQL is part of a program function and the function provides the input needed for your SQL query....

  • Write the following SQL statements in Microsoft Access by using the Books database from Week 2...

    Write the following SQL statements in Microsoft Access by using the Books database from Week 2 Assignment 2. Once complete, copy and paste the SQL statements in a Microsoft Word document: Write SQL statements: To update the publisher name from READ WITH US to READ FOR US To verify the updated name field for the publisher with ID 6 To make the following updates to the Publisher table (be careful with WHERE): Make Contact="John Travolta" for publisher with ID number...

  • The lab for this week addresses taking a logical database design (data model) and transforming it...

    The lab for this week addresses taking a logical database design (data model) and transforming it into a physical model (tables, constraints, and relationships). As part of the lab, you will need to download the zip file titled CIS336Lab3Files from Doc Sharing. This zip file contains the ERD, Data Dictionary, and test data for the tables you create as you complete this exercise. Your job will be to use the ERD Diagram found below as a guide to define the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT