DPIT115 Data Management and Security Final Assessment (Assignment)

DPIT115 Data Management and Security Final Assessment (Assignment 2)
Page 1 of 9
Diploma of Information Technology
DPIT115 Data Management and Security
Final Assessment (Assignment 2)
Autumn Session 2020
This exam represents 40% of the total subject marks
_______________________________________________________________________________
Due Date: 7 June 2020, 11:55 PM
________________________________________________________________________________________
DIRECTIONS TO STUDENTS
1. All questions are to be attempted
2. Total number of questions: 7 (SEVEN)
3. This is an individual assessment
4. All questions are to be answered by you without assistance from other people
5. This assessment requires you to submit only one Microsoft Word document
6. Do not include the questions in your answer
7. Your submission will be checked for uniqueness using Turnitin
8. Use your own words, provide your own examples and draw your own diagrams.
9. Show your solution as well as the steps taken to answer the questions
10. Submit your solution to Moodle by the due date.
If it is suspected that you have accessed or received additional assistance from another person, the
matter will be investigated as an alleged breach of the UOW College Academic Integrity and Student
Conduct Policy, in accordance with the Procedure for Managing Alleged Student Misconduct.
Please note, as part of this investigation, you may be required to undergo an oral examination to
verify your understanding of the assessment content.

DPIT115 Data Management and Security Final Assessment (Assignment 2)
Page 2 of 9
QUESTIONS 3, 4, 5, 6 and 7 REFER TO THE RELATIONAL TABLES
LISTED BELOW
CREATE TABLE EMPLOYEE(
ENUM DECIMAL(12) NOT NULL, /* Employee number */
FNAME VARCHAR(50) NOT NULL, /* First name */
LNAME VARCHAR(50) NOT NULL, /* Last name */
DOB DATE NULL, /* Date of birth */
CONSTRAINT EMPLOYEE_PKEY PRIMARY KEY(ENUM) );
CREATE TABLE DRIVER(
ENUM DECIMAL(12) NOT NULL, /* Employee number */
LNUM DECIMAL(8) NOT NULL, /* Driving license number */
STATUS VARCHAR(10) NOT NULL, /* Driver status */
CONSTRAINT DRIVER_PKEY PRIMARY KEY(ENUM),
CONSTRAINT DRIVER_UNIQUE UNIQUE(LNUM),
CONSTRAINT DRIVER_FKEY FOREIGN KEY(ENUM) REFERENCES EMPLOYEE(ENUM),
CONSTRAINT DRIVER_STATUS CHECK (
STATUS IN (‘AVAILABLE’, ‘BUSY’, ‘ON LEAVE’)) );
CREATE TABLE TRUCK(
REGNUM VARCHAR(10) NOT NULL, /* Registration number */
CAPACITY DECIMAL(7) NOT NULL, /* Capacity */
WEIGHT DECIMAL(7) NOT NULL, /* Weight */
STATUS VARCHAR(10) NOT NULL, /* Present status */
CONSTRAINT TRUCK_PKEY PRIMARY KEY(REGNUM),
CONSTRAINT TRUCK_STATUS CHECK
( STATUS IN (‘AVAILABLE’, ‘USED’, ‘MAINTAINED’)),
CONSTRAINT TRUCK_WEIGHT CHECK
( WEIGHT > 0.0 AND WEIGHT < 500 ), CONSTRAINT TRUCK_CAPACITY CHECK ( CAPACITY > 0.0 AND CAPACITY < 100 ) ); CREATE TABLE TRIP( TNUM DECIMAL(10) NOT NULL, /* Trip number */ LNUM DECIMAL(8) NOT NULL, /* Driving license number */ REGNUM VARCHAR(10) NOT NULL, /* Truck registration number */ TDATE DATE NOT NULL, /* Trip date */ CONSTRAINT TRIP_PKEY PRIMARY KEY (TNUM), CONSTRAINT TRIP_CKEY UNIQUE (LNUM, REGNUM, TDATE), CONSTRAINT TRIP_FKEY1 FOREIGN KEY (LNUM) REFERENCES DRIVER(LNUM), CONSTRAINT TRIP_FKEY2 FOREIGN KEY (REGNUM) REFERENCES TRUCK(REGNUM) ); CREATE TABLE TRIPLEG( TNUM DECIMAL(10) NOT NULL, /* Trip number */ LEGNUM DECIMAL(2) NOT NULL, /* Leg number */ DEPARTURE VARCHAR(30) NOT NULL, /* Departure city */ DESTINATION VARCHAR(30) NOT NULL, /* Destination city */ CONSTRAINT TRIPLEG_PKEY PRIMARY KEY (TNUM, LEGNUM), CONSTRAINT TRIPLEG_UNIQUE UNIQUE(TNUM, DEPARTURE, DESTINATION), CONSTRAINT TRIPLEG_FKEY1 FOREIGN KEY (TNUM) REFERENCES TRIP(TNUM) ); DPIT115 Data Management and Security Final Assessment (Assignment 2) Page 3 of 9 QUESTION 1 (10 marks) Read and analyse the following specification of a sample database domain. A University would like to create a database to record information about some of its activities. The university offers a number of degrees to students. A degree is described by a unique name, the total number of credit points required to complete a degree, and several requirements that must be satisfied by the future students. The university offers three types of degrees: undergraduate degrees, postgraduate degrees, and graduate certificate. Postgraduate degrees are available only for the students who have already completed an undergraduate degree. A description of a postgraduate degree includes a list of acceptable undergraduate degrees. A description of a graduate certificate includes a requirement on the total number of years of professional experience. Each degree consists of an ordered sequence of subjects. A description of a subject consists of its number in a sequence and unique code, unique title, total number of credits points a subject is worth, and a list of learning objectives. The university employs academic staff members, tutors and support staff members. A common description of a university employee consists of a unique employee number, first name last name and date of birth. First name, last name and date of birth uniquely identified each employee. Additionally, academic staff members and tutors are described by an academic degree achieved. Support staff members are described by a list of qualifications acquired in the past together with a date when each qualification has been acquired. The university assigns the academic staff members and tutors to the subjects. A subject has one or two academic members assigned and a number of tutors. Academic staff members and tutors can be assigned to many subjects. Support staff members are assigned to the degrees. Each support staff member is assigned to one degree, and a degree has one or more support staff members assigned. The university is divided into faculties and faculties are divided into schools. Academic staff members and tutors belong to one school, and each school consists of many academic staff members and tutors. The faculties and schools are described by the unique names. The university records information when the academic staff members and tutors first join the schools. The university also keeps the information about the former employees who worked at the university in the past. A description of a former employee is the same as a current employee, and additionally, it includes a hire date and end of employment date. (1) Draw a conceptual schema for the specification of a database domain listed above. Use the notation of UML simplified class diagrams explained to you during this subject. Note: you are not allowed to use any artificial identifiers and any attributes that are not mentioned in the specification. Use UMLet to draw the schema and paste images of your drawings into your Microsoft Word document. Add your name, student number and the date to your diagram. There is NO NEED to provide a detailed analysis of how a conceptual schema has been created. The final conceptual schema expressed in the UML simplified notation classes is subject is sufficient. (7 marks) Add two (2) new object classes with at least three (3) attributes each and appropriate associations. The choice of object classes, attributes and associations are up to you; however, these should relate to the existing scenario. Use UMLet to draw the changes to the schema and paste the second diagram into your Microsoft Word document. Write a text description that explains the additional objects, attributes and associations below the diagram. (3 marks) DPIT115 Data Management and Security Final Assessment (Assignment 2) Page 4 of 9 QUESTION 2 (10 marks) Consider the conceptual schema given below. Your task is to perform the steps of logical database design, i.e. to transform a conceptual schema given above into a collection of relational schemas. Before transforming add the attribute ‘date-made’ to the BUS class and ‘home-city’ to the DRIVER class. Draw the resulting conceptual schema adding your name, student number and the date to the drawing. Use UMLet and paste images of your drawings into your Microsoft Word document. For each relational schema clearly list the names of attributes, primary key, candidate keys (if any), and foreign keys (if any). Assume that an association method must be used to implement the generalization. Show your working as you step through the process of the transformation. DPIT115 Data Management and Security Final Assessment (Assignment 2) Page 5 of 9 QUESTION 3 (8 marks) Write the data definition statements of SQL that modify the structures of a database listed on page 2 of this assessment in the way described below. Note, that some of the modification may require more than one data definition statements of SQL statement. (1) Modify the consistency constraint of the sample database such that after the modification, it is possible to record in the database information about the trucks that have a capacity up to and including 220. (2 marks) (2) Modify the structure and consistency constraint of the sample database such that after the modification, it is possible to store information in the database about the total number of legs a trip consists of. Assume that a trip cannot consist of more than 20 legs. (2 marks) (3) Modify the structure and consistency constraints of the sample database such it is possible to store information in the database about the mechanics employed by a transportation company. Assume that a description of mechanic consists of an employee number, first name, last name, date of birth and qualification level. A qualification level is a positive integer number 1 or 2 or 3 or 4 or 5. Remember that a mechanic is an employee. (2 marks) (4) Modify the consistency constraints of the sample database so it is possible to store information about the trip without providing information about a driver licence number. Such modification is required when a driver leaves a transportation company, and we would like to keep information about all trips performed by the driver. (2 marks) DPIT115 Data Management and Security Final Assessment (Assignment 2) Page 6 of 9 QUESTION 4 (8 marks) Write the data manipulation statements of SQL that modify the contents of a database listed on page 2 of this lab task in the ways described below. Note that you are not allowed to modify and/or to drop any consistency constraints. Also note, that to implement some of the modifications listed below, you may need more than one data manipulation statement of SQL. (1) Assume that the largest number of a trip is 1200 (the largest value in a column TNUM in a relational table TRIP). Assume that a new trip has been completed today. The trip was from Sydney to Dubbo and then from Dubbo back to Sydney. The trip has been performed by a driver with a licence number 008 (column LNUM in a relational table TRIP) who used a truck with a registration number AL08UK. Insert appropriate information into a sample database. (2 marks) (2) Delete the information from the database about trip number 60. Remember, that the foreign keys in all CREATE TABLE statements have no ON DELETE CASCADE clause. (2 marks) (3) Change the status of all drivers who performed more than 106 trips to a value ON LEAVE. (2 marks) (4) Copy information about all employees born before the year 2000 to a new table E20CENT. There is no need to enforce any consistency constraints on the new table. (2 marks) DPIT115 Data Management and Security Final Assessment (Assignment 2) Page 7 of 9 QUESTION 5 (10 marks) Write SELECT statements that implement the following queries. (1) Find the first and the last names of all drivers who are not on leave. (2 marks) (2) Find the registration numbers of all trucks that have not been used so far. (2 marks) (3) Find the registration numbers of all trucks that have been used more than 200 times. (2 marks) (4) Find the distinct names of all cities visited during a trip number 7 or a trip number 12. Note: a city is visited if it is either a departure city or a destination city of any leg included within a trip. (2 marks) (5) Find the registration numbers of all trucks that have been used by both drivers with a driving licence number 006 and with a driving license number 008. (2 marks) DPIT115 Data Management and Security Final Assessment (Assignment 2) Page 8 of 9 QUESTION 6 (7 marks) Assume that a user root with a password 'DPIT115' created a database called transport and the user executed CREATE TABLE statements given on page 2 of the examination paper to create the relational tables in the database transport. Write a SQL script that performs the following operations by user ‘root’. Assume that the user ‘root’ has already connected to the database. (1) The user ‘root’ nominates a database transport as a default database, and then the user creates two roles ‘driver’ and ‘admin’. (1 mark) (2) The user ‘root’ grants read access rights to the relational tables EMPLOYEE and DRIVER to the role ‘admin’. The read access rights cannot be propagated to other roles or users. (1 mark) (3) The user ‘root’ grants the rights to insert the rows into a relational tables TRIP and TRIPLEG to the role ‘driver’. The access rights can be propagated to other roles or users. (1 mark) (4) The user ‘root’ grants the update privilege on all relational tables in the transport database to the role ‘admin’. The privilege cannot be propagated to other roles or users. (1 mark) (5) The user ‘root’ grant the read access rights to information about the total number of trips performed by each driver to a role ‘driver’. (1 mark) (6) The user ‘root’ creates five (5) new users and grants the role ‘driver’ to three (3) of the users, and the role ‘admin’ to the other users. The names and passwords of the new user accounts are up to you. (1 mark) (7) The user ‘root’ sets the resource limits for the users created in the previous step allowing six (6) maximum concurrent connections. Finally, the user ‘root’ locks all the user accounts created in the previous step. (1 mark) DPIT115 Data Management and Security Final Assessment (Assignment 2) Page 9 of 9 QUESTION 7 (7 marks) The implementation and testing of complex SELECT statements that operate on many relational tables and involve many sophisticated search conditions is a time-consuming and challenging task. (1) Describe the SQL programming technique you would use to simplify the implementation and testing of a complex SELECT statement. Note that we expect you to describe a technique that has been covered in tasks this subject. (4 marks) (2) Use the technique you described in the previous step to implement the following query as a SELECT statement: Find the first and the last names of all drivers who performed more than 25 trips so far in 2020. (3 marks) END OF ASSESSMENT

Related Post