讲解:CSCU9B3、SQL、SQL、Relational DatabaseProcessing|C

CSCU9B3 Relational Database Assignment 2018Computing Science and Maths, University of Stirling40% of module grade; due 4pm 19th NovemberEach week in the Stirling area, sporting teams meet to compete in games. More thantwo teams can compete in any given game and players win points for their teamrather than winning a game outright. Each week of the year there is one game,which takes place at one of a few possible venues. Not all teams compete everyweek. Teams can have different numbers of players. At the end of the year, theaverage points scored by each team are calculated and a league table is created.The data from the games, including team members and other information is storedin a very badly designed way. One long file is kept and at the end of each game, thepoints scored by each player are added to the file. The problem is that all theinformation about the player, the team and the game has to be included in everyrow of the file, so there is massive data duplication.The following data is stored about each player: A unique ID Forename Surname Team name Status (Professional or Amateur) Skills that they possessThis is stored about each team: Team name Home townAll of this data is stored in each row of the file, along with the following data about agame: The date of the game The venue of the game (where it was played) The number of points scored by the playerFor example:ID Forename Surname Team Status skill Name Town Venue Date Points10162 Gillian Botwright Racers Amateur Catching Racers B’ of Allan Doune 03/01/12 410162 Gillian Botwright Racers Amateur Jumping Racers B’ of Allan Doune 03/01/12 4What is worse, if a player has more than one skill, then the same data is repeated foreach of the skills, as you can see above. The data does not explicitly list every teamthat took part in each game: to see that you would need to look at every row for agiven date. Note that there is only one event on any given date. It is your job to turn this data into a relational database.The data is stored in the rawdata.csv file (and a version without headerinformation, for loading into the database, in noheaddata.csv), which you candownload from the module’s Canvas assignment page.Your assignment is to complete the following steps and present your results in awritten report. These instructions are detailed and following them properly shouldensure you get good marks:1. Design a set of tables for a relational database to store this data.2. In your report give an ER diagram showing the relationships between thetables. In your diagram, make sure you:a. Put the table name at the top of each tableb. List the fields in each tablec. Underline the primary key fieldsd. Put a * after the foreign key fieldse. Mark the cardinality of each relationship at both ends of theconnecting linef. Indicate optionality with a dashed line.3. In your report, write a justification for your design, considering aspects suchas data integrity and normalisation.4. Create these tables in MySQL by writing and executing (via the phpMyAdmininterface) the SQL for creating each of the tables, including all primary andforeign key definitions. Make sure you choose sensible types for the fields. Inyour report, show the SQL you have used.5. Write and execute SQL to create a table to hold the data from the nohead.csvfile and then upload the data into your database via the phpMyAdmin“import” facility (no need to mention this step in the report).6. Use SQL statements to extract the data from your first table into the correcttables that you created above. In your report, show the SQL for doing this forone example table only.7. In your report, write the SQL you would use to answer each of the followingquestions, and also include the results you get from executing the query. Youmust not use the table from step 5 – make all your queries from the tablescorresponding to your ER decomposition made in step 1.a. List each team name and the town they are based in.b. List the total number of games played by each team.c. List the total number of games played and the total points scored byeach player (list player name plus total number of games and pointsscored, but just give the first 10 results in your report).d. List the dates of all the games where the Jets and the Rams bothplayed.e. Write a query to produce the end of year team league table showingTeam name, Number of games played, Number of points gained,Average points per game for each team. 8. Starting with the template file, assignment.php (available from Canvas),using the PHP mysqli package (either the procedural or object-orientedversion) complete the PHP and SQL required to take whatever text is enteredin the form box and do the following:a. Search for any players whose names (forename or surname) containthe text entered.b. Display neatly in the web page the following characteristics of allmatching players found: ID, forename, surname, team, status, skillsc. Try out your code by placing this file (DO NOT rename it) in your webfolder on wamp0, as you did in practical exercises(\\wamp0.cs.stir.ac.uk\www\xxx where xxx is your username).d. In your report, include a copy of your code (please remove yourpassword and any other sensitive information from the copy shown inthe report) and give its URL iehttp://wamp0.cs.stir.ac.uk/xxx/assignment.php.Make sure your code is robust against any mistakes or malicious intent in textentered in the form box by a user of your webpage. During marking, yourwebpage will be trialled and this will be checked. As above, you should carryout your queries on the tables corresponding to your ER decomposition inpart 1.Marking breakdown and criteriaYour work will be marked out of 100, according to the following breakdown:1. ER diagram: 20%2. Justification of design: 20%3. Table creation: 10%4. Data transfer: 5%5. Searches: 25%6. PHP (Assignment.php): 15%7. Overall quality of your report: 5% Submitting your work and assessment proceduresThe assignment will be submitted as an electronic (PDF) type-written reportuploaded (via Turnitin) to Canvas by 4pm on Monday 19th November. DO NOT putyour name in the report, only your registration number.In the report, include all the components listed in the assignment steps. The reportshould be professionally presented and easy to read. 5% of the marks will be givenfor the quality of the report.Submission also includes placing your completed file, assignment.php, in your webaccessiblefolder on wamp0: \\wamp0.cs.stir.ac.uk\www\xxx where xxx is yourusername.Late submissionIt is possible for the co-ordinator to vary the dates for a student. If you must submityour work late (perhaps for medical reasons) then this can be arranged, but it mustbe discussed with the co-ordinator as soon as possible after the problem becomesknown. Assessed coursework submitted late will be accepted up to seven calendardays after the submission date (or expiry of any agreed extension) but the grade willbe lowered by three marks per day or part thereof. After seven days the piece ofwork will be deemed a non-submission and will result in a fail grade for the moduleas a whole.PlagiarismWork which is submitted for assessment must be your own work. All studentsshould note that the University has a formal policy on plagiarism which can befound at:https://www.stir.ac.uk/about/faculties-and-services/academic-registry/academicpolicy-and-practice/quality-handbook/assessment-and-academic-misconduct/#eightHow marks will be awardedMarks will be awarded both for the technical correctness of what you have done andalso for the clarity and organisation of how you describe it (this does not mean thatyou should give a long account of what you did).The assignment counts for 40% of the total course mark.The deadline for submission is Monday 19th of November 2018 at 4pm. 转自:http://ass.3daixie.com/2018112013362365.html

你可能感兴趣的:(讲解:CSCU9B3、SQL、SQL、Relational DatabaseProcessing|C)