17
Faculty of Computer Studies Fall 2005 Information Technology and Computing CS490 Selected Topics in Computer Science Database Management Systems CS490 Marking Guide TMA 02(Last updated on 10/22/2005 2:09:06 PM) Before reading this marking guide, you should read through chapters 1-7 of the text. Cut-off date 31 December 2005, Weight: 20% This tutor-marked assignment (TMA 02) comprises two questions. IMPORTANT NOTE: You must submit your assignment electronically to the e-TMAs conference of your group if you are using FirstClass, or through MOODLE, and provide a paper copy as well. The file format for any documents you submit should be in RTF format unless otherwise arranged with your tutor or noted below. Some of the problems and cases have been slightly modified from those in the text. Where differences exist, the version stated here will be the one used for marking purposes. Both questions are based on Chapters 1-7 of the text book and the workbook and assume knowledge of their content. The marks allocated to each question and its estimated time are given in parentheses (). Question 1 (40 marks, 6-12 hours) This question comprises a set of end-of-chapter exercises from the text. These exercises are listed in the course calendar and divided among the weeks of the course. Additional comments or clarifications of the problems are sometimes added between brackets []. Turn in your answers to the following Exercises: 4.1, 4.3, 4.7 and 4.23. Writing and executing simple SQL queries against Sally's Pet store database (schema on page 176 of the text). Test all your queries in Oracle against the sample database. 4.1 Writing and executing a simple projection and selection query on a single table using a date function (2marks) List the cats born in May Sample Answer: SELECT Animal.AnimalID, Animal.Name, Animal.Category, Animal.DateBorn FROM Animal WHERE (((Animal.Category)="Cat") AND ((Animal.DateBorn) Between #5/1/2004# And #5/31/2004#)); 4.3 Writing and executing a projection, selection and inner join query on multiple tables using a date function and ordering the result (2 marks)

Faculty of Computer Studies Fall 2005 Database Management

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Faculty of Computer Studies Fall 2005 Database Management

Faculty of Computer Studies Fall 2005 Information Technology and Computing CS490 Selected Topics in Computer Science Database Management Systems

CS490

Marking Guide TMA 02(Last updated on 10/22/2005 2:09:06 PM) Before reading this marking guide, you should read through chapters 1-7 of the text. Cut-off date 31 December 2005, Weight: 20%

This tutor-marked assignment (TMA 02) comprises two questions.

IMPORTANT NOTE: You must submit your assignment electronically to the e-TMAs conference of your group if you are using FirstClass, or through MOODLE, and provide a paper copy as well. The file format for any documents you submit should be in RTF format unless otherwise arranged with your tutor or noted below. Some of the problems and cases have been slightly modified from those in the text. Where differences exist, the version stated here will be the one used for marking purposes. Both questions are based on Chapters 1-7 of the text book and the workbook and assume knowledge of their content.

The marks allocated to each question and its estimated time are given in parentheses ().

Question 1 (40 marks, 6-12 hours)

This question comprises a set of end-of-chapter exercises from the text. These exercises are listed in the course calendar and divided among the weeks of the course. Additional comments or clarifications of the problems are sometimes added between brackets []. Turn in your answers to the following Exercises: 4.1, 4.3, 4.7 and 4.23. Writing and executing simple SQL queries against Sally's Pet store database (schema on page 176 of the text). Test all your queries in Oracle against the sample database. 4.1 Writing and executing a simple projection and selection query on a single table using a date function (2marks) List the cats born in May Sample Answer: SELECT Animal.AnimalID, Animal.Name, Animal.Category, Animal.DateBorn FROM Animal WHERE (((Animal.Category)="Cat") AND ((Animal.DateBorn) Between #5/1/2004# And #5/31/2004#)); 4.3 Writing and executing a projection, selection and inner join query on multiple tables using a date function and ordering the result (2 marks)

Page 2: Faculty of Computer Studies Fall 2005 Database Management

List the price, sale date and description of all merchandise sold in July ordered by price (most expensive first) (2 marks) Sample Answer: SELECT Sale.SaleDate, SaleItem.SalePrice, Merchandise.Description FROM Sale INNER JOIN (Merchandise INNER JOIN SaleItem ON Merchandise. ItemID = SaleItem.ItemID) ON Sale.SaleID = SaleItem.SaleID WHERE (((Sale.SaleDate) Between #7/1/2004# And #7/31/2004#)) ORDER BY SaleItem.SalePrice DESC; 4.7 Writing and executing a select-project query with a date function and aggregation (2 marks) What is the total value of animals sold in December? Sample Answer: SELECT Sum(SaleAnimal.SalePrice) AS SumOfSalePrice FROM Sale INNER JOIN SaleAnimal ON Sale.SaleID = SaleAnimal.SaleID WHERE (((Sale.SaleDate) Between #12/1/2004# And #12/31/2004#)); 4.23 Writing and executing a selection, projection and a 3-table inner join SQL query involving calculations (2 marks) Which cats sold for at least 50 percent more than their cost?

Sample Answer: SELECT Animal.AnimalID, Animal.Name, Animal.Category, [SalePrice]/[Cost] AS PriceRatio FROM (Animal INNER JOIN SaleAnimal ON Animal.AnimalID = SaleAnimal. AnimalID) INNER JOIN AnimalOrderItem ON Animal.AnimalID = AnimalOrderItem.AnimalID WHERE (((Animal.Category)="Cat") AND (([SalePrice]/[Cost])>1.5)) ORDER BY [SalePrice]/[Cost] DESC; 4.27, 4.32 and 4. 39 Writing and executing simple SQL queries against the Rolling Thunder database (schema on page 177 of the text). Test your queries in Oracle against the sample database. 4.27 Writing a Select-Project-Join SQL query using Null value & a date function. (2 marks) List all IDs and last names for all employees who sold race bikes shipped to Florida [State = FL] without the help of a retail store in 1999. Do not give any other details. [Hint: shipments made without the help of a retail store receive either no StoreID or a StoreID value < 3] Sample Answer: SELECT DISTINCT Employee.EmployeeID, Employee.LastName FROM Employee INNER JOIN Bicycle ON Employee.EmployeeID = Bicycle.EmployeeID WHERE (((Bicycle.SaleState)="FL") AND ((Bicycle.ModelType)="Race") AND ((Bicycle.StoreID)<3 Or (Bicycle.StoreID) Is Null) AND ((Bicycle.OrderDate) Between #1/1/1999# And #12/31/1999#)); 4.32 Write and execute a select-project-join query using grouping. (2 marks) List the IDs, last names, and number of headsets the employee has installed in mountain bikes, ordered such that the employee who installed the most headsets in mountain bikes appears first. Sample Answer: SELECT Employee.EmployeeID, Employee.LastName, Count (BikeParts.SerialNumber) AS CountOfSerialNumber FROM Bicycle INNER JOIN (Component INNER JOIN (Employee INNER JOIN BikeParts ON Employee.EmployeeID = BikeParts.EmployeeID) ON Component. ComponentID = BikeParts.ComponentID) ON Bicycle.SerialNumber = BikeParts.SerialNumber WHERE (((Component.Category)="Headset") AND ((Bicycle.ModelType) Like "mountain*")) GROUP BY Employee.EmployeeID, Employee.LastName ORDER BY Count(BikeParts.SerialNumber) DESC;

Page 3: Faculty of Computer Studies Fall 2005 Database Management

4.39 Writing and executing a SQL query using string matching and grouping with group conditions. (2 marks) Have the sales of mountain bikes (full suspension or hard tail) increased or decreased from 2000 to 2004 (by count not by value)? Sample Answer: SELECT Year([OrderDate]) AS SaleYear, Count(Bicycle.SerialNumber) AS CountOf- SerialNumber FROM Bicycle WHERE (((Bicycle.ModelType) Like "mountain*")) GROUP BY Year([OrderDate]) HAVING (((Year([OrderDate])) Between 2000 And 2004)); 5.9, 5.10, 5.17, and 5.25. Writing and executing advanced SQL queries 5.9 Using IN and Sub query List the customers who bought dogs in the first quarter and also bought dog food in the fourth quarter. Sample Answer: SELECT DISTINCT Customer.CustomerID, Customer.LastName, Customer. FirstName, Sale.SaleDate, Animal.Category FROM Animal INNER JOIN ((Customer INNER JOIN Sale ON Customer. CustomerID = Sale.CustomerID) INNER JOIN SaleAnimal ON Sale.SaleID = SaleAnimal.SaleID) ON Animal.AnimalID = SaleAnimal.AnimalID WHERE (((Sale.SaleDate) Between #1/1/2004# And #3/31/2004#) AND ((Animal.Category)="Dog")) AND Customer.CustomerID IN (SELECT Sale.CustomerID FROM Merchandise INNER JOIN (Sale INNER JOIN SaleItem ON Sale.SaleID = SaleItem.SaleID) ON Merchandise.ItemID = SaleItem.ItemID WHERE (((Sale.SaleDate) Between #10/1/2004# And #12/31/2004#) AND ((Merchandise.Description) Like 'Dog food*')) ) 5.10 Using Multi-step query and grouping with conditions (3 marks) What was the net change in quantity on hand for premium canned dog food between January 1 and July 1? [Hint: the net change in the quantity on hand for each item = amount purchased minus the amount sold] Sample Answer: [Ans3e 05-10a] SELECT Merchandise.Description, OrderItem.ItemID, Sum(OrderItem.Quantity) AS Purchased FROM Merchandise INNER JOIN (MerchandiseOrder INNER JOIN OrderItem ON MerchandiseOrder.PONumber = OrderItem.PONumber) ON Merchandise.ItemID = OrderItem.ItemID WHERE (((MerchandiseOrder.OrderDate) Between #1/1/2004# And #6/30/2004#)) GROUP BY Merchandise.Description, OrderItem.ItemID HAVING (((Merchandise.Description)="Dog Food-Can-Premium")); [Ans3e 05-10b] SELECT Merchandise.Description, Merchandise.ItemID, Sum(SaleItem.Quantity) AS Sold FROM Sale INNER JOIN (Merchandise INNER JOIN SaleItem ON Merchandise. ItemID = SaleItem.ItemID) ON Sale.SaleID = SaleItem.SaleID WHERE (((Sale.SaleDate) Between #1/1/2004# And #6/30/2004#)) GROUP BY Merchandise.Description, Merchandise.ItemID HAVING (((Merchandise.Description)="Dog Food-Can-Premium")); [Ans3e 05-10c] SELECT [Ans3e 05-10a].Description, [Ans3e 05-10a].ItemID, [Ans3e 05-10a].Purchased, [Ans3e 05-10b].Sold, [Purchased]-[Sold] AS NetIncrease

Page 4: Faculty of Computer Studies Fall 2005 Database Management

FROM [Ans3e 05-10a] INNER JOIN [Ans3e 05-10b] ON [Ans3e 05-10a].ItemID = [Ans3e 05-10b].ItemID; 5.17 Reflexive (self-join) query (3 marks) List the IDs and last names of all employees who report to Gibson, ordered alphabetically by last name Sample Answer: SELECT Employee.EmployeeID, , Employee.FirstName, Employee.Title FROM Employee AS Employee_1 INNER JOIN Employee ON Employee_1.EmployeeID = Employee.ManagerID WHERE (((Employee_1.LastName)="Gibson")) ORDER BY Employee.LastName ASC; 5.25 Writing and executing a SQL query to insert data into a table and using a subquery (3 marks) Create a copy of the Employee table structure. Use a delete query to remove all data from the copy. Write a query to copy from the original employee table into the new one. Copy the employees who did not sell any merchandise in December. Sample Answer: INSERT INTO [Copy of Employee] ( EmployeeID, LastName, FirstName, Phone, Address, ZipCode, CityID, TaxPayerID, DateHired, DateReleased, ManagerID, EmployeeLevel,Title) SELECT Employee.EmployeeID, Employee.LastName, Employee.FirstName, Employee.Phone, Employee.Address, Employee.ZipCode, Employee.CityID, Employee.TaxPayerID, Employee.DateHired, Employee.DateReleased, Employee.ManagerID, Employee.EmployeeLevel, Employee.Title FROM Employee WHERE Employee.EmployeeID NOT IN (SELECT DISTINCT Sale.EmployeeID FROM Sale INNER JOIN SaleItem ON Sale.SaleID = SaleItem.SaleID WHERE (((Sale.SaleDate) Between #12/1/2004# And #12/31/2004#))); 6.7 and 6.16 Create the tables and build the initial forms for the databases described by the exercises in Chapter 3. Results are variable, but students should create forms that resemble the forms in the original exercises. Forms may need additional work (totals and so on). 6.7 Create the tables and build the initial forms for the database described by exercise 3.1 (Web comments), repeated here for convenience: (3 marks)

Exercise 3.1 Creating a class diagram and normalized tables based on a single user form: A local retail firm is building a website and wants you to create a database to track information requests. The company wants to collect basic customer data, and then record when potential customers return to track their comments by topic. The topic is a predefined list of items (which managers can change) that potential customers will choose via a selection box. Define the normalized tables needed for this project. Create the class diagram and list of normalized tables for this case.

Page 5: Faculty of Computer Studies Fall 2005 Database Management

Sample Answer:

6.16 Create the tables and build the initial forms for the database described by exercise 3.10 (jeans manufacturer), repeated here for convenience: (3 marks)

Exercise 3.10 Creating a larger class diagram and normalized tables based on multiple user forms: A company that makes designer jeans is in trouble. The managers need help matching production to orders and ensuring that products are delivered to customers on time. The problem is made more difficult because each of the several styles of jeans can have many sizes, and customers have very specific orders. The orders can be quite large and are often filled by production from several factories, so several deliveries are needed to fill an order. The order, delivery, and production forms show the main items needed. Each factory has several shifts. A production line consists of about five employees who work on different aspects of the jeans. Create the class diagram and list of normalized tables for this case.

Page 6: Faculty of Computer Studies Fall 2005 Database Management

Sample Answer: C06Ex15.mdb Form: Order. Note that the subtotal requires additional code later.

Page 7: Faculty of Computer Studies Fall 2005 Database Management

7.3 Creating a data trigger in Oracle (4 marks) Create a data trigger that writes a row in a new table whenever employee salary is changed. Store the date changed, the employee, the old salary and the new value. Sample Answer: Create a ChangeLog table, then (in Oracle) CREATE TRIGGER trgUpdateEmployee AFTER UPDATE ON Employee FOR EACH ROW BEGIN INSERT INTO ChangeLog (EmployeeID, ChangeDateTime, OldSalary, NewSalary) VALUES (:NEW.EmployeeID, SYSDATE, :OLD.Salary, :NEW.Salary); END;

Page 8: Faculty of Computer Studies Fall 2005 Database Management

7.4 Creating a data trigger in Oracle (4 marks) Create a data trigger that will prevent anyone from increasing an employee salary by more than 50 percent. Sample Answer: CREATE TRIGGER trgSalaryLimit BEFORE UPDATE ON Employee FOR EACH ROW BEGIN IF (:OLD.Salary > 0) AND (:NEW.Salary/:OLD.Salary>1.5) THEN raise_application_error(-20101,’Salary increase is too large’); END IF END; The following exercises are OPTIONAL 8.4 Creating a data cube (0 marks, optional) Create a cube for Sally's pet store to browse merchandise sales by time, state, employee, and item category. Sample Answer: Query: Ans3e 08-04; Spreadsheet/PivotTable: C08Ex04.xls Note that you will have to change the data source for the PivotTable because your copy of the database will likely be in a different folder. Open the spreadsheet; choose Data/Refresh Data; which generates an error message. Follow the prompts to reselect the database and find it on your machine. 8.10 Simple time series analysis (0 marks, optional) As a simple time series analysis, extract the merchandise sales for Sally's pet store by week, plot the data, and estimate the trend line. Sample Answer (Microsoft ACCESS ®): SELECT Year([SaleDate]) & "-" & Right("0" & Format([SaleDate],"ww"),2) AS SaleWeek, Sum([Quantity]*[SalePrice]) AS [Value] FROM Sale INNER JOIN SaleItem ON Sale.SaleID = SaleItem.SaleID GROUP BY Year([SaleDate]) & "-" & Right("0" & Format([SaleDate],"ww"),2);

Page 9: Faculty of Computer Studies Fall 2005 Database Management

SaleWeek Value 2004-01 27 2004-02 578.7 2004-03 284.22 2004-04 99 2004-05 369.9 2004-07 394.38 2004-08 1056.96 2004-09 57.6 2004-10 91.8 2004-11 594.63 2004-12 1346.4 2004-13 297.9 2004-14 31.95 2004-15 191.7 2004-16 29.25 2004-17 156.6 2004-19 0 2004-20 152.1 2004-21 72 2004-23 382.05 2004-24 163.8 2004-25 76.5 2004-26 94.5

2004-28 22.5 2004-29 67.5 2004-30 8.1 2004-31 70.2 2004-33 35.8 2004-34 32.4 2004-35 94.5 2004-38 243.9 2004-39 45 2004-42 83.7 2004-43 116.1 2004-44 466.2 2004-45 246.15 2004-46 99 2004-47 107.1 2004-48 0 2004-50 4.5 2004-52 160.2

Page 10: Faculty of Computer Studies Fall 2005 Database Management

9.8 Security policies and procedures (0 marks, optional) Employees and other insiders present the greatest security problems to companies. Outline basic policies and procedures that should be implemented to protect the computer systems. (Hint: Research employee hiring procedures.) Sample Answer: Computer systems must be protected by both physical and logical security. Physical security involves restricting access to the computer center. This should involve restricting access by keypad or other locking mechanism, even during working hours. Data that is kept on personal computers should be backed up at the main computer center to avoid loss of data by a disgruntled or malicious worker. Logical security procedures should also be in place. These involve restricting access to sensitive data by using passwords and queries. In addition, division of duties should be in place to insure that at least two people are involved in any major financial transaction. 10.8 Distributed databases (0 marks, optional) Define a three-tier system for Sally's pet store. In particular, what business rules and applications would you store on the middle tier? Sample Answer: Computer systems must be protected by both physical and logical security. Physical security involves restricting access to the computer center. This should involve restricting access by keypad or other locking mechanism, even during working hours. Data that is kept on personal computers should be backed up at the main computer center to avoid loss of data by a disgruntled or malicious worker. Logical security procedures should also be in place. These involve restricting access to sensitive data by using passwords and queries. In addition, division of duties should be in place to insure that at least two people are involved in any major financial transaction. 10.12 Distributed databases and security (0 marks, optional) Rolling Thunder is planning to expand by sending sales representatives around the country to various bike shops. They will have laptops to configure and take new orders. But, most bike shops will not have Internet connections, so the system will have to work offline. Describe how this system will work. What security provisions will be needed? Sample Answer: Microsoft points out that physical access negates all logical security controls. You can see it by removing a disk drive from a secured machine and attaching it to an unsecured machine—all files will be accessible to the administrator of the new machine. Plus, you have to worry about physical destruction and theft of the equipment. Consequently, the server has to be stored in a secure room, protected from fire if possible. Access to the room should be limited to a few key employees. It might be necessary to protect the machines on the floor by locking them into desks. Cables should be hidden and relatively inaccessible. There should not be open ports or open wireless access to the network.

Page 11: Faculty of Computer Studies Fall 2005 Database Management

Question 2 Database Project (60 marks, 20-40 hours)

Big Chemical, Inc.

To truly learn how to build business applications, you need to work on a database project. The project described here is probably simpler than real-life projects but complex enough to illustrate common problems that you will encounter. The project is designed to be built throughout the term. Students should demonstrate a completed database application at the end of the term. Preliminary questions or assignments are given for the project to get you started. However, the most important aspect of the case is to build the final, complete application. You can also benefit from the feedback you received from your instructor on TMA01 and the weekly exercises and lab exercises, which represent intermediate stages. The most important advice is that you must begin work on the project as soon as possible. Do not put the project off until the end of the semester. To have any chance at completing the project, most students will have to put in 20 to 40 hours of time. The project will reinforce the concepts discussed in the chapters—particularly data normalization and application design. Class projects are slightly different from real-world applications, but they have many features in common. One of the most challenging aspects is that any project contains a level of uncertainty and ambiguity. When you start a real-life project, you never know exactly what the project is going to involve. As you talk with users, you encounter contradictions, uncertainty, and confusion over terms and goals. In real-life, you resolve these problems through experience and discussions with managers. With class projects, you do not have direct access to the managers and users. The instructor can answer some questions, but students will need to make their own decisions and interpretations. When you first read the case, try to focus on the big picture. Identify the environment, goals, and objectives of the proposed system. You should take notes on the company and jot down additional questions. Additional research of the industry and similar firms will help identify terms, goals, and potential problems. When you begin to analyze the individual forms and reports, you need to identify the overall purpose of each form. You should be able to describe the purpose of each form in one sentence. Avoid using the form’s title—describe its purpose in your own words. For any of the cases, you should make this list and keep it handy so you always remember the overall purpose of the application. Remember that you will have to rework the normalization several times before the project is complete. Every time you change the primary keys, you first have to delete relationships. Try to develop a good normalized list before you begin creating forms and reports, but leave yourself enough time to go back and change the tables if you find problems. In many cases it pays to start small and add tables and features slowly. Start with an initial set of tables and keys that you are certain are correct. Then begin building forms. Add columns and tables as you need them. If your initial tables are correct, you should be able to add new columns and tables without altering the existing design. For the final project, it is usually better to complete half a project where everything works, instead of a large mess where nothing works. One final word of advice: back up your work. Always keep a backup copy of your project on a different disk. Two or three copies are even better. Disks are cheap. Preliminary Remarks: Big Chemical, Inc is a large company specializing in custom chemistry research and production. Its researchers often work on highly-sensitive projects for various government agencies. Even the work it does for other companies tends to be secretive because client firms do not want others learning about their new product ideas. Consequently, the company is extremely sensitive about security issues. Although they are cautious about hiring and use background checks, they still want to keep closer track of their employees. They are in the process of installing sensors on every door and gate in building on the main campus. Employees will be issued badges that are automatically read at each point. The system will

Page 12: Faculty of Computer Studies Fall 2005 Database Management

be able to track each person crossing through a door. But, the company also wants the ability to check data for the last week or month, so it needs a database to hold the data and produce reports on employee activity Employee Information Figure 1 shows the basic data collected on employees. Note that the company randomly tests employees for the presence of various drugs (including alcohol). The results of the tests and any comments are summarized. The details of the test are kept in a different system indexed by the LabTestID. On this form, the results can be one of three values: Clear, Fail, Caution. After two cautionary results or one failure, the employee is fired. Sensors Figure 2 shows the location of the sensors. Each door will be fitted with a sensor that will send the data to the main system as a stream of bytes. This system will be able to insert rows into data tables created in the new application. Several types of sensors are used to compensate for different sizes and characteristics of doors. The company needs to keep track of the type of sensor in case one needs to be replaced. Also, most of the sensors are capable of indicating the direction the person traveled through the door—which is labeled “in” or “out” by the installer. Ultimately, all of the sensors will be displayed on an electronic map of the building.

Figure 1

Figure 2 Figure 3 is a basic sensor repair log. Although the sensors are fairly reliable, the company needs to track any downtime. If a sensor is not working, some queries will give misleading results. For example, it might appear that a person never leaves a room if the room has two doors and one of the

Page 13: Faculty of Computer Studies Fall 2005 Database Management

sensors is broken. While this log does not completely solve the problem, at least it will make it possible for users to realize that a problem might exist. Employee Access: As shown in Figure 4, employees have to be graded access to specific buildings and rooms. Data from this from is transferred to the entry control system for the building. Some rooms are not locked, but still have sensors. Other rooms are locked, and the sensors open the door only for employees who have been granted access. Access is granted by project directors who have control over certain rooms and the employees who report to them. Directors are responsible for keeping the lists up to date. To provide stronger security, directors are required to enter a starting and ending date for the access right. Beyond the ending date, employees will be denied access. In general, employees are also restricted to specific times. For example, an employee could be allowed into a research lab during normal working hours, and then locked out at night. The main gate sensor is similar to the door sensors, but it is monitor differently. Some employees are required to be off the premises after a certain time of day. Figure 5 would never be printed in real life, because there would be too much data. It represents the sensor activation data collected by every sensor in the company. The sensors record the date and time as well as the person going through the door. The direction of travel is also noted. The sensors are relatively accurate and can even handle two people entering a door at approximately the same time. If one person enters a room and immediately turns around, it would be recorded as an entrance followed by an exit—adding two rows of data.

Figure 3

Figure 4

Page 14: Faculty of Computer Studies Fall 2005 Database Management

Figure 5 With almost 20,000 employees on the main campus, a dozen buildings with several floors of offices and labs, the sensors collect a large amount of data every day. In general, security personnel want the ability to track the movements of employees throughout the day. In most cases, the report shown in Figure 6 is displayed only when security personnel become suspicious of an employee. The report is slightly tricky to create when rooms have several doors. Also, remember that sometimes sensors fail, so the system might not record a person entering or leaving a room. Ultimately, managers would like to see a graphical display of this data—based on an electronic map of the campus. But, for now, they will be happy with this report that shows all of the activities of a suspicious employee.

Figure 6 Tasks: 1. Create the feasibility study (initial proposal). 2. Create a list of all of the forms and reports that the company might use. 3. Create a normalized list of tables for each form and report. 4. Create an integrated list of normalized tables for the entire application. Draw the corresponding class diagram. 5. Create the basic tables in a DBMS along with all necessary relationships and integrity constraints. Enter sample data into the tables to test your design. 6. Evaluate the normalized tables and estimate the size of the database—both current size and estimated size in 3 years. 7. List the initial security conditions for the data tables. Create a list of user groups and identify their basic access needs. 8. Design the overall structure of the application. Outline the overall structure and the primary forms. Select a design scheme, including layouts, effects, and colors. 9. Build three initial input forms. 10. Build three initial reports. 11. Improve the forms and reports to make them easier to use. 12. Test your forms and reports with sample users. 13. Build additional forms and reports. Improve all of them. Test all of them. 14. Connect all of the forms and reports into an application. Test all the links. Test the forms and reports. Check for consistency.

Page 15: Faculty of Computer Studies Fall 2005 Database Management

TMA02 Deliverables

Hand in the following by the cut-off date: Question 1 (The exercises):

1. Database files containing implementations of all queries, forms and triggers required, along with the database they operate against. Name your queries and triggers after the question number for easy identification.

2. A report in RTF format containing: a. All queries, forms, and triggers implemented b. Instructions about how they can be found in the files you provided.

Question 2 (The project):

1. A report in RTF containing: a. Your Initial Proposal. b. The feasibility study. c. Your assumptions and system limitations. d. A list of all of the forms and reports that the company might use. e. A normalized list of tables for each form and report before the integration. f. An integrated list of normalized tables for the entire application (the relational

schema). g. The corresponding class diagram. h. Your Evaluation of the normalized tables and your estimate of the size of the

database—both current size and estimated size in 3 years. i. Your list of the initial security conditions for the data tables. j. Your list of user groups and their basic access needs. k. Your design of the overall structure of the application including:

i. An outline of the overall structure and the primary forms. ii. Your choice of a design scheme, including layouts, effects, and colors.

l. Your comments about how you made the forms easy to use. m. Your comments about how you tested the application.

2. An Oracle database file containing:

a. The implemented tables along with all necessary relationships and integrity constraints and sample data used to test your design.

b. All queries, forms, reports, and triggers implemented.

Page 16: Faculty of Computer Studies Fall 2005 Database Management

Marking Guidelines

This is a large project that requires the student to think about the requirements and produce a complete application. You can expect significant variations in student answers, but a possible schema for this application is as follows: Employee(EmployeeID, EmpLastName, EmpFirstName, TaxpayerID, DateHired, Department, SupervisorID, EmpHomePhone, EmpAddress, EmpCity, EmpState, EmpZIP, ClearanceLevel, EmpTitle, GateEntryTime, GateExitTime, EmpOffice, EmpPhone, EmpCellPhone You need to keep Badge as a separate table because the sensors can only record the BadgeID And you need a fast link/lookup. Plus, an employee could lose a badge. Badge(BadgeID, EmployeeID, DateIssued) EmployeeEducation(EmployeeID, EdStartDate, EdEndDate, School, Degree, GPA EmployeeDrugTest(EmployeeID, DrugTestDate, LabUsed, TestUsed, LabTestID, DrugResults, DrugTestComments Room(RoomID, BuildingID, Floor, DirectorID Sensor(SensorID, RoomID, Door, SensorType, SensorDateInstalled SensorRepair(SensorID, DateDown, DateRestored, Technician, FailureCause, SensorRepair EmployeeAccess(EmployeeID, RoomID, AccessStartTime, AccessEndTime, AccessStartDate, AccessEndDate SensorActivation(SensorID, SensorDateTime, BadgeID, Direction There are some points to keep in mind when marking this assignment: • Do not penalize students for making reasonable assumptions and simplifications as long

as they state them clearly. Naturally, student assumptions will differ markedly from one student to another.

• The question makes the following important statement: "For the final project, it is usually better to complete half a project where everything works, instead of a large mess where nothing works". Consequently, students who finish a half project where everything works should receive more than half the credit.

• A complete project should include:

Feasibility and estimates (8 marks): 1. A feasibility study and initial proposal (4 marks) 2. Size estimates for tables (4 marks) Design (20 marks): 3. A list of all of the forms and reports that the company might use (4 marks) 4. A normalized list of tables (4 marks) 5. A Corresponding class diagram (4 marks)

Page 17: Faculty of Computer Studies Fall 2005 Database Management

6. Overall structure of application (4 marks) 7. Initial security design (4 marks) Implementation (32 marks): 8. Created tables in the DBMS with sample data (4 marks) 9. Three initial forms (6 marks) 10. Three initial reports (6 marks) 11. Attempts to improve usability of the forms and reports (3 marks) 12. Testing (4 marks) 13. More forms and reports (4 marks) 14. A completely connected application (5 marks)

• Please feel free to modify the marking sheet, if you do not feel comfortable with any of the items included as long as you keep the basic marking structure the same, i.e. 8 marks for feasibility and estimates, 20 marks for the design, and 32 marks for the implementation.