Sie sind auf Seite 1von 5

ISYS1055/1057 Database Concepts S2/2013 Assignment 2 Due time: 10:00pm 14 October 2013 Monday in Week 12.

Worth: 50 marks in total -- initial submission is 3 marks and the final submission is 47 marks. This assignment is 20% of the overall assessment for the course. Assignments 1 and 2 together is a hurdle to pass the course. Question 1. (12 marks). Answer questions below regarding the relational database design for the R University book loan management database. Each question is worth 4 marks.
Book(call-no, title, authors, location, copy-barcode, status)

1.1

List all likely FDs on the above relation Book. Specify all candidate keys for Book and explain using inferences on the FDs. The relation is not in BCNF. Explain the reason using inferences on the FDs. Create a Book table with primary key definition in your Oracle account. Insert some artificial data into your table. Write SQL statements for creating the table and inserting data. Explain the data redundancy in the Book table. Decompose Book into relations in BCNF/3NF following the BCNF/3NF decomposition algorithm. Specify the primary key, any other candidate key, and any foreign keys for each relation after decomposition.

1.2

1.3

Question 2. (11 marks) Consider the below requirements for building a database for the company Blue Kangaroo that provides consultancy services. Each staff member has a unique employee ID and a first name, and a last name. Some senior staff members supervise junior staff members. Staff members have qualifications such as PhD, Master or Bachelor. The date when and institution where the degree is awarded are also recorded. A staff member may have several qualifications. Clients of Blue Kangaroo are described by unique client ID, name, location and contact phone umber. There are projects. Each project has a unique project ID and a title, and contracted start and end dates. Several staff members may be working on a project, and each of them plays a different role for the project. For example, project manager, business analyst and developer are some typical roles for projects. Project meetings are also recorded, including details like date, time, attendees, and minutes.

According to the given description, construct an Entity Relationship (ER) diagram for the database, and make assumptions where necessary. You must represent entities, relationships and their attributes, and all applicable constraints in your ER diagram. Explain any concepts that can not be expressed in the ER diagram. Your ER diagram must use notations in the lecture notes and should not be hand drawn; otherwise you will receive zero mark. You should use the ER diagramming tool Dia, which can be downloaded from the course Blackboard (Course Content ER Diagram Tools).

Question 3. (24 marks) The Online Movies DataBase (OMDB) is as follows: MovieInfo (mvID, title, rating, year, length, studio) DirectorInfo(directorID, firstname, lastname) MemberInfo(username, email, password) ActorInfo(actorID, firstname, lastname, gender, birthplace) CastInfo(mvID*, actorID*) DirectInfo(mvID*, directorID*) GenreInfo(mvID*, genre) RankingInfo(username*, mvID*, score, voteDate) To distinguish tables from those in the Village Cinema database for lectures, all tables are named with the suffix Info. Members rank movies for scores of 15. Primary keys are underlined and foreign keys are marked with *. The SQL script for defining and populating the database omdb2-all.sql can be downloaded from the course blackboard (Course content Databases). Each component of your SQL statement must be on a separate line, subqueries should be indented for easy reading. For example,
SELECT mvid FROM movieinfo WHERE year=2000 AND mvid NOT IN (SELECT mvid FROM cast WHERE actorid > 10) ORDER BY mvid;

Do not include the result of the query or the script used to create the tables. Questions below are of increasing level of difficulty. Each question is worth 4 marks. Write ONE SQL query for each of Questions 3.13.5; otherwise you will receive zero mark for the question. Your query should not produce duplicates in output but use DISTINCT only if necessary. 3.1. How many members have not voted for any movies? 3.2. What is the average ranking score for each genre of movies? Output each genre together with its average score. Output should be in descending order of average score. 3.3. Which director directed the largest number of comedy movies? Output directorID, firstname, lastname of the director together with the total number of comedy movies s/he directed. You must use the ALL operator. 3.4. Show the actorID, firstname, lastname of actors who played in drama movies, together with the number of drama movies they played. Show the list in descending order of number of movies played.

3.5. List the details of actors who have ONLY played in drama movies. Output should be listed in descending order of number of movies an actor played. 3.6. Explain what the SQL query below is doing in English. Literal explanation like "Select mvid from GenreInfo where genre is Drama and where mvid in the set of mvids selected from GenreInfo where genre is not Drama" will receive zero mark.
select actorinfo.actorID,actorinfo.firstname,actorinfo.lastname,count(castinfo.mvID) from castinfo, genreinfo, actorinfo where genreinfo.genre = 'Drama' and castinfo.actorID = actorinfo.actorID and castinfo.mvID = genreinfo.mvID and actorinfo.actorID not in (select actorID from castinfo minus select actorid from castinfo, genreinfo where castinfo.mvID =genreinfo.mvID and genreinfo.genre = 'Drama') group by actorinfo.actorID, actorinfo.firstname, actorinfo.lastname order by count(castinfo.mvID) desc;

Submission and Marking University Plagiarism Statement This is an individual assignment. Plagiarism in oral, written or visual presentations is the presentation of the work, idea or creation of another person, without appropriate referencing, as though its ones own. Plagiarism is not acceptable and may result in charges of academic misconduct which carries a range of penalties. It is also a disciplinary offence for students to allow their work to be plagiarised by another student. For details, please check the course guide. Initial submission will be due in your tute/lab class in Week 11. You are strongly advised to complete at least one third of total number of questions for the initial submission. Your initial submission must be a .zip file via the WebLearn assignment submission
system and you must select Xiuzhen Zhang as the tutor. The .zip file should contain .pdf files for Questions 1 and 2, and a plain text .sql file for Question 3. All files should be named after your student number. For example, if your student number is s123, you should submit s123.zip, which contains s123_1.pdf, s123_2.pdf and s123_3.sql.

Final submission will be due at 10:00pm 14 October 2013 Monday in Week 12.
Submit one .zip file in the same format as that of the initial submission via the WebLearn assignment submission system and you must select Xiuzhen Zhang as the tutor.

Marking Initial submission (3 marks) Feedback to your initial submission will be provided in your tute/lab class in Week 11. Assessments of initial submission include WL assignment submission receipt (1 mark), submission file formats (1 mark) and correctness of answers (1 mark). You will get the full mark for correctness only if you have at least one correct answer to each question: o Question 1: answer for Question 1.1 or 1.2, o Question 2: one entity for your ER diagram, and o Question 3: one SQL query. Final submission (47 marks) not in the required format will incur deduction of 5 marks. A penalty of 10% per day of the toal marks will apply for each working day being late. After 5 working days, you will receive zero mark for the assignment. Mark for final submission will be given in two weeks. o SQL queries will be marked for correctness, understandability and efficiency. o The ER diagram will be marked for correctness and completeness for representing concepts in the given description.

Das könnte Ihnen auch gefallen