CSCI235 Database Systems Project
CSCI235 Database Systems Project
CSCI235 Database Systems Project
Scope
This project includes the tasks related to the database normalization, implementation of
consistency constraints, implementation of derived attributes and programming database
transaction, and design of BSON database.
The outcomes of the project are due by Saturday, 28 November, 2020, 7.00pm (sharp).
This project consists of 4 tasks and specification of each tasks starts from a new page.
The outcomes of the project must be submitted through Moodle in the same way as all
other coursework tasks in the subject. A submission link is available in a section THE FINAL
PROJECT (Available from 21 November, 2020) just below a link to specification of the
project.
A submission of the outcomes of the project marked by Moodle as "late" is treated as a late
submission no matter how many seconds it is late. If you have poor Internet connection
then allocate more time for a submission procedure. Please apply a principle saying that "it
is better to submit a project 1 hour too early than 1 second too late".
A policy regarding late submissions is same as for late submissions of all coursework tasks
in the subject and it is explained in the subject outline.
A submission of compressed files (zipped, gzipped, rared, tared, 7-zipped, lhzed, … etc) is
not allowed. The compressed files will not be evaluated.
All files left on Moodle in a state "Draft(not submitted)" will not be evaluated.
It is expected that all tasks included within Project will be solved individually without
any cooperation with the other students. If you have any doubts, questions, etc. please
consult your lecturer or tutor during lab classes or office hours. Plagiarism will result in a
FAIL grade being recorded for the assessment task.
Tasks
Step 1 (8 marks)
Improving a database design
This task requires access to either csora Oracle 19c database server, or one of data-
pc.. Oracle 19c database servers, or Oracle 19c running on a virtual machine.
Consider a conceptual schema given below. The schema describes a domain of a sample
database where a number of football teams participate in a competition. Each team is
identified by its name. The teams are located at the cities. Name of a city uniquely identifies
each city. The teams play games in round-robin system, i.e. each team plays two games
with all other teams. One game is played at home and one game is played away. A moment
in time when a game starts and a venue of a game uniquely identifies each game. The
referees enforce the rules during the games. To simplify a sample database domain, we
assume that one game is referred by only one referee (like in U7 competitions). We do not
have a lot of referee and because of that we assume that a pair of attributes: first name and
last name uniquely identifies each referee.
SQl scripts dbcreate.sql and dbdrop.sql can be downloaded from Moodle. SQL
script dbcreate.sql can be used to create the relational tables implementing a sample
database. SQL script dbdrop.sql can be used to drop the relational tables. The files
dbcreate.lst and dbdrop.lst contain the reports from processing of the scripts.
A database designer made few mistakes at the stages of conceptual modelling and logical
design, i.e. during creation of conceptual schema and during transformation of conceptual
schema into the relational schemas.
Your first subtask is to remove the mistakes made by a database designer. This
subtask is worth 7 marks.
And again, please be aware, that both original conceptual schema and the original relational
schemas may contain few mistakes.
If you find that the transformations of the relational schemas into BCNF are needed then
improve a script dbcreate.sql such that all relational tables created through processing
of the script are in BCNF. Save the final relational schemas in a file solution1.pdf.
Again, please keep in mind that an objective is to have the smallest number of relational
tables in BCNF.
Append at the very end of a script dbcreate.sql SQL statements that insert data into
the relational tables created in the previous step. Insert in to the database information about
at least three cities, three teams, three games played, and two referees. Please do not
underestimate this task. Insertion test may reveal design problems much faster than a
formal approach based on analysis of functional dependencies.
Process an upgraded script dbcreate.sql and save a report from processing in a file
solution1.lst.
Your report must include a listing of all SQL statements processed. To achieve that put the
following SQLcl commands:
SPOOL solution1
SET ECHO ON
SET FEEDBACK ON
SET LINESIZE 100
SET PAGESIZE 200
SPOOL OFF
Deliverables
A file solution1.pdf with analysis of functional dependencies, derivations of minimal
keys, identifications of the valid normal forms and transformations (if any) of the relational
schemas into BCNF whenever it is necessary. A file solution1.lst with a report
from processing of a script dbcreate.sql. A report must have no errors and it must list
all SQL statements processed.
Step 2 (7 marks)
Automatic verification of a logical consistency constraint
This task requires access to either csora Oracle 19c database server, or one of data-
pc.. Oracle 19c database servers, or Oracle 19c running on a virtual machine.
Please use a sample database created in Task 1 for this task. A logical consistency
constraint is up to you. It is very important, that your logical consistency constraint
CANNOT BE ENFORCED BY CREATE TABLE statement. We shall not be able to
grant you any marks for implementation of automatic verification of a logical consistency
constraint, that can be enforced by CREATE TABLE statement.
Use can use either stored PL/SQL procedures/functions or database triggers to implement
automatic verification of a logical consistency constraint.
Please consider verification of a logical consistency constraint when a new row is inserted
into a relational table, when a row is updated, and when a row is deleted from a relational
table.
And again, please make sure that a logical consistency constraint you implement cannot be
enforced by CREATE TABLE statement.
Implement SQL script file solution2.sql that performs the following actions.
(1) First the script contains a comment that explains what logical consistency constraint is
implemented. When processed with SET ECHO ON the script will automatically
display the comment. For example, see a file dbcreate.lst.
(1) Next, the script implements verification of a logical consistency constraint using either
stored PL/SQL procedures/functions or database triggers.
When ready, process a script solution2.sql and save a report from processing in a
file solution2.lst.
Your report must include a listing of all SQL and PL/SQL statements processed. To achieve
that put the following SQLcl commands:
SPOOL solution2
SET ECHO ON
SET FEEDBACK ON
SET LINESIZE 100
SET PAGESIZE 200
SET SERVEROUTPUT ON
SPOOL OFF
Deliverables
A file solution2.lst with a report from processing of a script solution2.sql. A
report must have no errors and it must list all SQL statements processed.
Task 3 (8 marks)
Implementation of a derived attribute and transaction processing
This task requires access to either csora Oracle 19c database server, or one of data-
pc.. Oracle 19c database servers, or Oracle 19c running on a virtual machine.
A derived attribute is an attribute in a relational table such that its values can be computed
from the contents of one or more relational tables in the same database.
Your first subtask is to add a new derived attribute to a sample database and to
implement a stored PL/SQL procedure that updates the values of the new derived
attribute after modifications of sample database. The stored procedure must be
implemented such that it may corrupt a database when processed at isolation level
read committed. This subtask is worth 4 marks.
Implement SQL script file solution3.sql that performs the following actions.
(1) First, the script creates a derived attribute in a database obtained from the
implementation of Task 1. The derived attribute can be appended to one of the
relational tables or it can be located in a new relational table. The values of a derived
attribute must be numerical. The values of derived attribute must be computed from
the contents of a sample database
(2) Next, create a stored PL/SQL procedure that computes the values of the derived
attribute from the present contents of a sample database. The stored procedure must
be implemented such that it may corrupt a database when processed at isolation level
read committed. Assume, that we use the scheduler implemented by Oracle 19c
database server.
(3) Next, update a sample database such that a derived attribute must be recomputed after
the update.
(4) Next, list the values of a derived attribute, process a stored procedure implemented in
a step (2) above to update the values of a derived attribute, and list the values of a
derived attribute after the updates.
Your report must include a listing of all SQL and PL/SQL statements processed. To achieve
that put the following SQLcl commands:
SPOOL solution3
SET ECHO ON
SET FEEDBACK ON
SET LINESIZE 100
SET PAGESIZE 200
SET SERVEROUTPUT ON
SPOOL OFF
at the end of SQL script.
Your second subtask is to prove that a stored PL/SQL procedure implemented in the
first task cannot be processed at an isolation level read committed. This subtask is
worth 4 marks.
Deliverables
A file solution3.lst with a report from processing of a script solution3.sql. A
report must have no errors and it must list all SQL statements processed.
This task requires access to MongoDB 4.2 database server available on a virtual machine.
First, create a logical schema of a new collection games. Use a graphical notation
introduced in a presentation 22 BSON Design, slide 25, slide 31, and in a file
jsontpchr.bmp available on Moodle. You can use UMLet 14.3 with CSCI235-
835Palette to draw a logical schema. UMLet 14.3 is available on Moodle in a section
OTHER RESOURSEC. A readable picture of a neat hand drawing is also acceptable.
(2) Next, insert into a collection games the same information as in Task 1 (Insert in to
the database information about at least three cities, three teams, three games played,
and two referees).
(3) Finally, insert a document that fails a validation of only one of the constraints listed
above. Add a comment explaining why a document failed a validation.
When ready create a report from processing of solution4.js in the following way.
Select the entire contents of the file and Copy it into a buffer.
Open a new Terminal window and start mongo client in the following way.
mongo –port 4000
Paste the contents of the buffer copied earlier from gedit window in front of > prompt
of mongo client. You may have to press Enter key to process the last query in a case when
it is not followed by a newline control character.
Select the entire contents of the Terminal window and Copy&Paste it into a file
solution4.lst. Save a file solution4.lst. Examine the contents of a file
solution4.lst and make sure that it does not contain any errors.
Deliverables
A file solution4.pdf with a logical schema of a collection games.
End of specification