COIS20026 Database Development and Management (T1 2015)
Assessment item 2—Assignment 2
Due date: Midnight AEST Friday of Week 10 ASSESSMENT
Length: No fixed length 2
This assessment item relates to the course learning outcomes numbers 1, 2, 4 and 5 as stated in page 3 of the course profile.
Relational database implementation
You must implement the entity relationship model provided in the sample solution of Assignment 1. The sample solution will be released on the course website approximately TWO (2) weeks after the Assignment 1 due date.
The recommended tool for this assignment is Microsoft Access, version 2003 or later. One reason for recommending Microsoft Access is that your course lecturer will be able to provide support in the use of this tool. If you choose to use a different DBMS, then there is no guarantee that your lecturer will be able to provide support. The remainder of this document assumes you are using Access.
In implementing the ERD provided, you must complete the following tasks:
• Map the ERD into a set of relations in at least Third Normal Form (3NF). You must ensure that your relations meet 3NF. There is no need to show your working.
• Select any two (2) of your relations from the previous step and for each of them:
• List all the functional dependencies present in the relation
• Demonstrate that the relation meets Third Normal Form (3NF), for example:
STUDENT (StudentID, Name, Address, DateOfBirth)
The primary key is StudentID; this is the only candidate key since Name is not guaranteed to be unique (two different students may have the same name). Address is also not guaranteed to be unique. There will be one student name per Student ID, since only one name is recorded for each student. There will be one address per Student ID; even though a student may have multiple address (e.g. a home address and a work address), the case study states that there is only a need to record the home address. There will be only one date of birth per Student ID. This means that Student ID functionally determines every other attribute in the table; therefore there are no repeating groups. There is a single simple candidate key, therefore no partial dependencies are possible. Name cannot be used to functionally determine any other attribute in the table since two different students may have the same name; likewise for address and date of birth, therefore there are no transitive dependencies in the table. Therefore it meets the requirements of first, second and third normal form.
• Create all the relations in a Microsoft Access database. Consider each attribute in every table and make appropriate choices regarding data types and sizes, indexes, required/not required, and validation rules. Your choices should be appropriate for each attribute and should support data integrity. (Note: see the Data Integrity section below for specific data integrity requirements.)
• Create relationships as appropriate. Enforce referential integrity for all appropriate relationships in the database. Explore the possibility of cascade update and/or delete options.
• Review the default indexes created by Access for each table. You should ensure that the indexes follow the guidelines given in the set textbook.
• Populate the database with sample data. You must include sufficient sample data to test your queries and report(s). You should aim for at least 5 or 6 rows in every table. Please note that the expected result of query questions may depend on the actual sample data populated.
You are required to implement integrity constraints within the database to enforce the following requirements:
For the table Currency:
• All fields must be entered.
• Currency code must be consisted of 3 letters.
• Current interest rate must be in the range 1% and 100%.
For the table Review:
• All fields must be entered.
• The only valid values for a recommendation must be “Buy”, “Sell”, or “Hold”.
• Reason field can’t be null.
For the table Trade:
• All fields must be entered.
• The quantities traded must be not less than 1000 units.
• Transaction date can’t be future-dated.
Create queries to answer the following information requests. Note: Do not use the Access query builder (QBE) to create your queries – you should type the queries manually using SQL view.
Although it is optional to justify the effectiveness of your SQL statement for the request, the marking process of MS Access queries for information requests may also consider your justification of the effectiveness for your queries in the implementation report if you provide them. (Expected results using sample data for queries depend on your actual sample data populated in the database. The following results of queries are only shown as examples. It is important that your SQL statement must reflect the correct business logic & SQL syntax.)
1. Show a list of all recommendations made after 1st January 2015 on the currencies of US dollar and Euro. Display the details including analyst name, currency code, recommendation, review date and reason.
Query 1 Result
FirstName LastName CurrencyCode Recommendation ReviewDate Reason
John Johnson USD Buy 6/03/2015 Fed financial QE policy
Joshua Andersen EUR Buy 15/02/2015 Forecast Eurozone GDP increase
Linda Aka EUR Hold 2/01/2015 Euro central bank interest decision
2. Which portfolio has least amount of available cash? List the details including portfolio number, available cash, host client name, contact phone, and the responsible manager name.
Query 2 Result
PortfolioID AvailableCash ClientName ContactPhone ManagerName
1007 $50,000.00 Dennis Dale 48007761 Ken King
3. List the currency or currencies that have two or more ratings.
Query 3 Result
CurrencyName InterestRate NbrOfRating
Euro 0.00% 2
US Dollar 1.00% 2
4. How many trades has each manager performed? Show the manager’s name, contact phone and the total number of trades performed. Order the list so that the manager with the most trades appears first.
Query 4 Result
FirstName Lastname ContactPhone NbrOfTransaction
Ken King 0749554433 4
Mark Pauline 0748090945 2
Jeff Lincoln 0748090161 2
Fred Hoffman 0748095613 1
David King 0748505033 1
5. List details that managers have bought the currency of British pound and Japanese Yen in second half year of 2014. These details include manager’s name, currency name, quantities purchased, exchange rate and transaction date.
Query 5 Result
FirstName LastName CurrencyName QuantityPurchased ExchangeRate TransactionDate
Fred Hoffman Japanese Yen 11000 0.01 5/11/2014
Ken King British Pound 200000 1.65 5/10/2014
Ken King British Pound 4000 1.58 9/09/2014
6. Find out three currencies that have been most frequently traded. Your query result should include the currency code, currency name, interest rate and how many times they have been traded. Sort the result by the number of times they were traded (Hint, using top, count functions.)
Query 6 Result
CurrencyCode CurrencyName InterestRate NbrOfTimesTradedd
GBP British Pound 2.00% 3
NZD New Zealand Dollar 2.00% 2
EUR Euro 0.00% 2
Note: The word of currency is a reserved word in MS Access. Thus when you use it for SQL query, you have to put a bracket like [Currency]. This is similar for other reserved words like order, name etc.
Create a simple report showing the details of all trades of investors in their portfolios. These details include the investor name, currency code, quantities traded of each currency as well as the transaction date. Your report should have an appropriate layout, similar to the one below.
• Create a query that lists all details needed for a report. If you are unable to formulate this query, then create a report that is based directly on the table. (Note: you will not be able to obtain full marks for the report creation if you base your report directly on the table and some criteria are not met in your reports.)
• Use the report wizard to generate a basic report based upon your query (or the table if you were unable to formulate the query).
• Once the report wizard finishes, switch to design view and rename the labels to match those shown in the report above; for example, change FirstName to First Name etc.
You must also provide a short implementation report describing your experiences with this assignment. You may discuss any of the following:
a) You may see more than one design choice (such as whether or not to introduce a surrogate key, the data type selection for a particular attribute, etc) whilst implementing this database. If so, describe the relative merits of the alternatives.
b) You should clearly show each of the SQL statements for the information requests. Describe your experience with MS Access SQL. (Note: It is optional to justify why your SQL statements are effective in addressing each information request.)
c) You may have encountered some limitations in the DBMS you were using whilst trying to implement this database. Describe what you were trying to implement and explain the limitations you encountered.
d) You may reflect on what you have learned during this assignment, what areas you think you need to improve on, and how you intend to improve your knowledge of those areas.
Use the implementation report to demonstrate that you have thought carefully about the issues that arise when implementing a relational database.
What you should submit
• A Microsoft Access database file containing:
1. Tables with sample data
4. Integrity constraints 5. Report.
• A Microsoft Word document containing:
1. Two relations with functional dependencies and demonstration of normalisation
2. Implementation report
Your document should contain appropriate identification information (your student number, name, course number, etc.) and should be appropriately formatted. For example, your document should contain a brief introduction stating the purpose of the document, as well as headings for each section.
• You must work individually on this assignment.
• The model solution to this assignment will be released approximately TWO (2) weeks after the due date.
• Assignments that are submitted after the release of the model solution will receive zero.
• Please read the case study in the document one more time as there are additional bold texts that serves to clarify points for the purpose of Assignment 2.
• You must state in your assignment (at the end under the heading Acknowledgements is a good place) all materials and sources you used. This may be as simple as 'This assignment was completed using only the COIS 20026 course materials' if that was all you used.
• Extension requests (by filling in an online form) should be submitted before the assignment due date. A penalty of 5% of the total mark per calendar day will apply for late submissions without an extension, or zero if submitted after the release of the model solution.
• Before submitting your assignment, review the marking criteria as shown on the last page of this document. Ensure that all the criteria are addressed in your submission.
COIS20026 Assignment 2 Marking Sheet
Student number: Student name:
Relational database implementation (12 marks) Available marks Marks awarded
•Set of relations correctly mapped from ERD 3
•Relationships set up correctly, integrity enforced, appropriate use of cascade update/delete 2
•Data types & sizes selected appropriately 2
•Indexes – Indexes are appropriate 1
•Functional dependencies correctly listed for two of the relations 2
•Normalisation correctly listed for two of the relations
Data integrity (4.5 marks)
•Data integrity correctly implemented for Currency table 1.5
•Data integrity correctly implemented for Review table 1.5
•Data integrity correctly implemented for Trade table
Queries (12 marks)
•Query 1 2
•Query 2 2
•Query 3 2
•Query 4 2
•Query 5 2
Report (2.5 marks)
•Underlying query/queries has/have been created and are correct 1.5
•Report layout is appropriate
Implementation report (4 marks)
•Implementation report discusses appropriate issues 4
Sub-total before any possible deductions 35
Late penalty (enter as the number of days late)
Assignment 2 total: /35