CP2404 / CP5633 Database Modelling
Task 1: Creating the database [61 marks]
1. Use MySQL Workbench to create a relational database model as presented in the
following ERD. This is a simplified database model designed for a bookshop company
named ‘JM Books’.
PKs should be correctly specified. All necessary attributes should be specified by setting
appropriate data types and appropriate field lengths. [Save the completed model as
a .mwb file]
2. Create a physical database model using the forward engineering process on MySQL
3. Insert the data supplied into the database. You may choose to use either the SQL
INSERT syntax or the import facility provided by MySQL Workbench. (Note: the names
or order of attributes in the data files may not exactly match those shown in the ERD)
4. Finally, dump the database into one integrated file on MySQL Workbench. [Save the
file as .sql file]
Task 2: Creating queries [40 marks]
Using the database you constructed in Task 1, create the following SQL queries in MySQL
Workbench. The resulting table for each query should look like the one provided for each
question if you created the database correctly as required. [Paste your SQL query into a
Word document to submit]
1. List the name of each author whose last names start with letter “O” or end with “phen”.
2. List the title of each book published by Penguin USA.
3. List the title of each book that is in the type of CMP, HIS, or SCI.
4. Write query to find out publisher_name and total copies of book ‘Song of Solomon’
5. Write SQL query to find out how many book copies available at the “JM Downtown”
branch and “JM On the Hill” having price that is greater than $10 but less than $20.
6. For each book title (in an alphabetical order) with more than four copies, show how
many copies in total the JM bookshop has and what the average price is.
本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易！
E-mail: [email protected] 微信:itcsdx