Book Seller Database DDL & Queries Solution


The following questions are based on the Book Seller ERD as shown below.

Tasks:

1.Write the SQL DDL to create the database that contains each of the relations shown in the above ERD. You will need to provide:

a.Your DDL code for each table that you create;

b.A screenshot showing each table that is created. (20 marks)

Notes:

– Use appropriate data types for each of the attributes;
– Use correct integrity constraints for each of the tables you create;
– You are to use the primary keys identified in the ERD;
– You are to identify and implement appropriate primary keys in the associative tables;
– You may need to create additional attributes in associative tables;
– Your SQL DDL code needs to be in the correct format for your RDBMS.

2.Before any row can be entered into the BOOKS table, the Author_ID must already exist in the AUTHOR table, why? (2 marks)

3.Write and execute SQL definition commands for each of the following queries:

a.Add the attributes Email, Comments and Send Newsletter to the CUSTOMERS table. Give those attributes an appropriate size and data type (5 marks).

b.Change the attribute BOOK_CATEGORY_DESCRIPTION from 15 characters to 50 characters. (3 marks)

4.Write and execute SQL commands for the following:

a.Add the following customers to the Customer table. (3 marks)

12345, Jones, George, 123 Bentinck St, Bathurst, NSW, 2795, 0213455678
23456, Jones, Pauline, 48 Summer St, Orange, NSW, 2800, 0223456789
34567, Wilson, Paul, 23 Long St Blayney, NSW, 2799, 0298765432

b.Write a command that will remove the Jones that lives in Orange from the Customer table. (2 marks)

You are required to submit:

1.The appropriate SQL commands, which should be copied from your source code inMySQL, and pasted into your submission file; and

2.The resultant tables, which must be screenshots to show the change due to the execution of commands.

Typing or manually drawing the results are NOT acceptable.

Leave a Reply

Your email address will not be published. Required fields are marked *



  • File Format: .docx
  • No of Pages: 9
  • Database Used: mySQL
  • Figures Included: Yes