CSG1207/CSI5135 Systems and Database Design Assignment Help

General Assignment Information

Before a database can be implemented and used, it must be designed in a way that ensures it is appropriate for the task at hand. Tools such as Entity-Relationship Diagrams and Data Dictionaries assist in designing and communicating the structure of a database. Once a design has been finalised, the database can be implemented in a DBMS. The Data Definition Language commands of SQL are used to create the database and its tables, attributes and constraints, after which the Data Manipulation Language commands can be used to manipulate data within the database. This assignment takes you through the design and implementation process, using Microsoft SQL Server.

You may work in pairs (maximum of 2 people) to complete this assignment, or choose to work alone. If you wish to work in a pair, you must inform your tutor (by email) of the names and student numbers of both members at least one week before the due date of Task 1. If you choose to work alone, be aware that there are no extra marks to compensate for the heavier workload. If working in a pair, work through the whole assignment together, rather than dividing it and completing sections individually. This will help to ensure that both people learn the content and contribute evenly.

The assignment consists of two tasks. The first task, Database Design, requires a word processed document in PDF format detailing the design of your database. The second task, Implementation, is a collection of SQL scripts which create and populate the database designed in the first task, and then query the data it contains. A small amount of marks are dedicated to presentation, notation and formatting.

While Task 1 is worth relatively few marks it is the basis of Task 2, and therefore it is very important that it is done well, otherwise further work will be required before Task 2 can be attempted.

Task 1 – Database Design (20 marks)
Your first task is to design a database for the scenario detailed on the following pages. Your final database design should comprise of approximately 8 entities.

State any assumptions (2 marks) you have made regarding your database design at the beginning of the database design document. Do not make any assumptions that significantly change the structure of the scenario, as this may make Task 2 of the assignment more difficult or inapplicable. Only make assumptions that influence your database design. If you are unsure about an assumption you wish to make, ask your tutor.

Once you feel you have identified the entities, attributes and relationships of the scenario in sufficient depth, you are required to create a logical ER diagram (4 marks) and a corresponding physical ER diagram (4 marks) to depict your database. Adhere to the distinctions between logical and physical ER diagrams covered in Lecture 3. It is recommended that you draw your diagrams on paper first, in order to find a layout that is clear and can be created in an electronic format.

Lastly, create a data dictionary (8 marks), with an entry for each entity in your database. The entries should list the name of the entity (table), a description of its purpose, a list of attributes (columns), important information about the attributes (e.g. data type, null/not null, identity, default values…), and details of any constraints applied to attributes. List the entries in your data dictionary in an appropriate table creation order that can be used to create the database. Include any additional information, if any, that may be needed to implement the database. Remember, a data dictionary should contain all the information needed to implement a database. Use the data dictionary in Lecture 4 and the data dictionary of the “company” database (Module 5) as examples.

Some marks are also awarded for presentation and notation (2 marks).

Your complete database design should consist of a list of assumptions, logical and physical ER diagrams and a data dictionary. This should be submitted as a single PDF document. Make sure that your assignment includes the unit code, assignment number/name, year and semester and your name and student number on the first page.

Please ensure that your completed database design is in PDF format, and open the PDF file before submitting it to ensure that your diagrams appear as intended.

Scenario Details

You are required to design and create a database for an online store. The database must encompass the customers, items, categories of items and the orders made. You have the following information about the way the store operates:

Customers & Addresses

  •   Customer details must be recorded. This includes a customer number, first name, last name, email address, password and a column containing either a “Y” or an “N” to indicate whether the customer wishes to receive the store’s email newsletter. The store wishes to ensure that each customer has a different email address.
  •   The store wishes to implement a “referral system” to reward customers who tell others about the store. Therefore, customer details should also include a “referrer” column, which will contain the customer number of the customer who referred them, if applicable (not all customers are referred by someone).
  •   Customers can define addresses which are stored in the database. A customer can define multiple addresses, and each address is associated with a single customer via their customer number. As well as specifying the address, customers can (optionally) specify a name for the address, e.g. “Home”. An address number is used to uniquely identify each address.

Items & Categories

  •   Item details must be recorded. This includes an item number, name, description and price.
  •   A list of item categories must be recorded, and the database must keep track of which items are in which categories. All items are in at least one category, but can be in several of them. The only category details required are a category number and category name.
  •   To receive more relevant newsletters, customers can specify which categories they are interested in. Which customers are interested in which categories must be stored in a table of the database. The newsletter categories are the same as those which are linked to items.Orders
  •   Details of orders made by customers must be recorded. This includes an invoice number, the date of the order and customer number of the customer who made the order. The order details should contain two foreign keys referencing the address table – one for the delivery address and one for the billing address.

     A customer therefore needs to define at least one address in order to make an order. The same address can be used for both the delivery and billing address.

  •   For each order, the database must also record details of ordered items and the quantity ordered. Each order must contain at least one item, and an item can be in multiple orders.

General Information and Guidelines

The information above describes all of the entities, attributes and relationships required in the database design. Some minor details, such as the cardinality of some relationships, have been omitted. It is up to you to make (and state) any assumptions you need in order to complete the database design. If you are uncertain about any part of the scenario described above, seek clarification from your tutor.

It is recommended that you use auto-incrementing integers as the primary key for most entities in this scenario, although a compound primary key may be appropriate in some tables such as the one keeping track of which items are in which categories.

Be sure to specify the most appropriate data type (and length, where applicable) for each attribute in your data dictionary. Note that when you are storing a date/time, it should be stored as a single column – do not split the date and time into two columns unless there is a very good and necessary reason to do so. Where sample data is provided, make sure it fits into the columns lengths you use.

Read the scenario details several times to ensure that your database design incorporates all the elements described. If you desire feedback on your work in progress, send it to your tutor.

CSI5135 Additional Requirements

If you are in CSI5135, the following additional requirements apply. If you are in CSG1207, you do not need to do implement these requirements (but you are encouraged to do so if you want).

Ensure that your database design (and implementation in Task 2) incorporates the following:

  •   The name of each category must be unique
  •   Customer email addresses must contain a “@” symbol
  •   The quantity of an ordered item must be between 1 and 100, with a default of 1
  •   For security reasons, customer passwords will be encrypted using “bcrypt” before storing them in the database. You must do a small amount of research to determine an appropriate data type and length for the password column so that it is able to contain bcrypt hashes. It is up to you whether you actually put bcrypt hashes into the column when writing your sample data in Task 2 – it will not be used in any of the queries.

    Several of these requirements will be implemented using CHECK constraints when creating the database. Specify these CHECK constraints in your data dictionary in a way that clearly describes what is being checked, or using the actual SQL code required to create the constraints.

Task 2 – Implementation (40 marks)

Once your database has been designed, it is time to implement it in a DBMS, populate the database, and then manipulate the data via queries. The deliverables of this task are three files containing SQL statements. We will be using Microsoft SQL Server 2014 or above – your SQL scripts must run in the same environment used in the unit/labs.

Create your scripts as three “.sql” files, with the filenames listed in the following headings. Templates for the script files are provided with this assignment brief – please use them. Format your code for readability, and use comments for headings and to provide further detail or information about your code if needed (2 marks).

As each of the script files will contain numerous SQL statements, it is very useful to be aware of a particular feature of SQL Server Management Studio (SSMS): If you have selected some text in a query window, only the selected text will be executed when you press the Execute button.

View More