INFS2200语言 辅导、 写作sql留学生程序、sql编程语言 写作

” INFS2200语言 辅导、 写作sql留学生程序、sql编程语言 写作INFS2200/7903 PROJECT ASSIGNMENTSemester Two 2020Marks: 100 marks (25%)Due Date: 11:59PM 30-October-2020What to Submit: SQL script file + a short reportWhere to Submit: Electronic submission via BlackboardThe goal of this project is to gain practical experience in applying several databasemanagement concepts and techniques using the Oracle DBMS.Your main task is to first populate your database with appropriate data, then design,implement, and test the appropriate queries to perform the tasks explained in the nextsections.You must work on this project individually. Academic integrity policies apply. Pleaserefer to 3.60.04 Student Integrity and Misconduct of the University Policy for moreinformation.Roadmap: Section 1 describes the database schema for your project and it alsoprovides instructions on downloading the script file needed to create and populate yourdatabase. Section 2 describes the tasks to be completed for this project. Finally,Section 3 provides you with all the necessary submission guidelines.Enjoy the project!—————–SECTION 1. THE MOVIES DATABASEThe Database: The MOVIES database (Figure 1) captures the information regardingmovies and the actors in these movies. The database includes six tables: film, actor,category, language, film_actor, and film_category. Film keeps track of film details.Actor stores information about all actors in the movie industry. Category stores theinformation about the different types of film categories. Language stores the differentlanguages in which these movies are released. Film_actor and film_category keeptrack of which actors have acted in which films, and which films are classified underwhich categories, respectively.Figure 1 Database schemaThe Script File: Please go to Blackboard and download the supplementary script filefor this project prjScript.sql.film_category film film_actorcategory languageactorThe Database Constraints: The following table lists all the constraints that should becreated on the MOVIES database.No Constraint Name Table.Column Description1 PK_ACTORID actor.actor_id actor_id is the primary key ofactor2 PK_CATEGORYID category.category_id category_id is the primary keyof category3 PK_FILMID film.film_id film_id is the primary key of film4 PK_LANGUAGEID language.language_id language_id is the primary keyof language5 UN_DESCRIPTION film.description Film description values areunique6 CK_FNAME actor.first_name Actors first name must not beempty (not null)7 CK_LNAME actor.last_name Actors last name must not beempty (not null)8 CK_CATNAME category.name Category name must not beempty (not null)9 CK_LANNAME language.name Language name must not beempty (not null)10 CK_TITLE film.title Film title must not be empty(not null)11 CK_RELEASEYR film.release_year film.release_year is less than orequal to current year (Hardcodethe current year 2020)12 CK_RATING film.rating Rating type must be one of thefollowing: G, PG, PG-13, R,NC-1713 CK_SPLFEATURES film.special_features Special features type must beeither empty or one of thefollowing: Trailers,Commentaries, DeletedScenes, Behind the Scenes14 FK_LANGUAGEID film.language_idand language.language_idfilm.language_id refers tolanguage.language_id15 FK_ORLANGUAGEID film.original_language_idand language.language_idfilm.original_language_id refersto language.language_id16 FK_ACTORID film_actor.actor_id andactor.actor_idfilm_actor.actor_id refers toactor.actor_id17 FK_CATEGORYID film_category.category_idand category.category_idfilm_category.category_idrefers to category.category_id18 FK_FILMID1 film_actor.film_id andfilm.film_idfilm_actor.film_id refers tofilm.film_id19 FK_FILMID2 film_category.film_id andfilm.film_idfilm_category.film_id refers tofilm.film_idTable 1. Database constraints—————–SECTION 2. ASSIGNMENT TASKSCreate and Populate Database: You need to execute the script file prjScript.sql tocreate and populate your database before working on the following tasks. Wait till yousee the message DONE! All data has been inserted. It should only take one minute.The script will also drop related tables.Task 1 Constraints1. After running the script file, you will notice that only some of the constraints listedin Table 1 were created. Write a SQL statement to find out what constraints havebeen created on the tables. (Note: Some table names may need to be in capitals,e.g., FILM instead of film)Question: Which constraints in Table 1 have been created on these tables?2. Write the SQL statements to create all the missing constraints.Task 2 Triggers1. Assume that the film_id should be automatically populated when a new film isadded. Write a SQL statement to create a sequence object to generate values forthis column. The sequence, named FILM_ID_SEQ, should start from 20,010 andincrement by 10.2. Write a SQL statement to create an Oracle trigger called BI_FILM_ID that bindsthe sequence object FILM_ID_SEQ to the film_id column, i.e., the trigger populatesvalues of FILM_ID_SEQ to the film_id column when a new film is added.3. Write a SQL statement to create an Oracle trigger BI_FILM_DESP that appendstext to the description of every new film inserted into the database. The text isbased on the rating, the language, and the original language of the film. The formatof the text you append should be as follows (replacing tokens):rating-seq: Originally in original language. Re-released in language.Here, seq is the sequence number of the film with that rating, and originallanguage and language should be the name of the language from the languagetable.Hint: You might need to use some built-in functions for string manipulation suchas TO_CHAR, CONCAT, SUBSTR, INSTR, etc.Notes for Task 2.3: The new description must match the expected output exactly in order to receivemarks. For example,o Do not add extra space or line break;o Do not change capitalisation of the rating or the language names. If either rating, language_id, or original_language_id of the new film is null, thenthe trigger should do nothing, i.e., the new film uses the original description. You do not need to handle the cases where the resulting text after the triggerexceeds the description length. Let the trigger fail. Do not use hardcode. Your trigger should be able to handle other languagesbeyond those provided to you in the SQL script.o For example, if the language SQL is added to the language table, then thetrigger should be able to handle a movie in SQL.Task 3 Views1. Write a SQL statement to find the Action (category) films with the shortest runningtime (length). Your query should output the titles and lengths of the films.2. Write a SQL statement to create a (virtual) view called MIN_ACTION_ACTORSthat contains all the actors who have acted in the films you obtained in Task 3.1.The view should include the columns actor_id, first_name, and last_name. (Note:Each actor should only appear once in the view, even if they may have acted inmultiple films)3. Write a SQL statement to create a (virtual) view called V_ACTION_ACTORS_2012that lists the ids, first names and last names of all the actors who have acted in anAction film released in the year 2012. (Note: There should be no duplicate rowsin the view, similar to Task 3.2)Example: Assume the following film is inserted into the database, which is the5th film with a rating PG (i.e., there are already 4 films with the rating PG in thedatabase), and the current FILM_ID_SEQ value is 20,010.INSERT INTO film (title, description, language_id, original_language_id, rating)VALUES (B Movie, Movie about wasps., 1, 2, PG);It should produce the following result when the following SQL statement is run:SQL SELECT description FROM film WHERE film_id = 20010;DESCRIPTION—————————————————————————————–Movie about wasps.PG-5: Originally in Italian. Re-released in English.4. Write a SQL statement to create a materialized view MV_ACTION_ACTORS_2012that lists the same information as in Task 3.3.5. Execute the following two SQL statements and report their query execution time.Question: Did the materialized view speed up the query processing? Explain youranswer. (Hint: You should look at both the elapsed time and the cost in the queryexecution plan)SELECT * FROM V_ACTION_ACTORS_2012;SELECT * FROM MV_ACTION_ACTORS_2012;Note: For any task mentioning the execution time, please run the queries on acomputer with a HDD rather than an SSD, so that the timing difference is noticeable.All lab computers have HDDs and are appropriate for such task.Task 4 Indexes1. Write a SQL statement to find the first 100 films (in ascending alphabetical orderof the film titles) that take place in a Boat, i.e., the word Boat appears in the filmdescription. (Note: You should avoid using LIKE in the SQL statement and insteaduse string manipulation functions)2. In order to potentially speed up the query in Task 4.1, a function-based index couldbe created on the film table. Write a SQL statement to create an index IDX_BOATthat best fits the task and justify your choice.3. Report the execution time of the query statement you wrote in Task 4.1 before andafter creating the index in Task 4.2.Question: Did the index speed up query processing? Explain your answer. (Hint:You should look at both the elapsed time and the cost in the query execution plan)4. Write a SQL statement to count the number of films for which there are at least 40other films with the same release_year, rating, and special_features values.5. In order to potentially speed up the query in Task 4.4, indexes should be createdon the release_year, rating, and special_features columns.Question: In your opinion, what is the most suitable index type to create on thosecolumns, and why? (Note: Do not include any SQL to create the index in your scriptfile; just provide your answer in the report)Task 5 Execution Plan1. A B+ tree index PK_FILMID has been generated automatically for the primary keyfilm_id of the table film. Write SQL statements to answer the following Questions: What is the height of the B+ tree index? What is the number of leaf blocks in the B+ tree index? What is the number of block access needed for a full table scan of the film table?Hint: You may find the following documents from Oracle helpful for Task 5.1: httpss://docs.oracle.com/cd/B28359_01/server.111/b28320/statviews_5119.htm#REFRN29025 httpss://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_4473.htm#REFRN26286 httpss://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2105.htm#REFRN202862. The following SQL statement lists all the films with a film_id larger than 100:SELECT * FROM FILM WHERE FILM_ID 100;Report the rule-based execution plan chosen by the Oracle optimizer for executingthis query.Question: Explain the query processing steps taking place in this plan.3. Report the cost-based execution plan chosen by the Oracle optimizer for executingthe query in Task 5.2.Question: Explain the query processing steps taking place in this plan. In youropinion, what are the main differences between the plans you obtained in Task 5.2and Task 5.3, based on the statistics from Task 5.1 and your calculation?4. The following SQL statement lists all the films with a film_id larger than 19,990:SELECT * FROM FILM WHERE FILM_ID 19990;Report the cost-based execution plan chosen by the Oracle optimizer for executingthis query.Question: Explain the query processing steps taking place in this plan. In youropinion, what are the main differences between the plans you obtained in Task 5.3and Task 5.4, based on the statistics from Task 5.1 and your calculation?5. The following SQL statement lists all information for the film with a film_id of 100:SELECT * FROM FILM WHERE FILM_ID = 100;Report the cost-based execution plan chosen by the Oracle optimizer for executingthis query.Question: Explain the query processing steps taking place in this plan. In youropinion, what are the main differences between the plans you obtained in Task 5.3and Task 5.5, based on the statistics from Task 5.1 and your calculation?Marking Scheme:Tasks MarksPresentation Readability 3Total 100—————–SECTION 3. DELIVERABLESThe project is due 11:59PM, 30 October 2019. Late submissions will not be acceptedunless you are approved for an extension (refer to Section 5.3 of the ECP).You are required to turn in two files (use StudentID to name your files):1. StudentID.pdf: (replacing StudentID) Submit on Blackboard via the Turnitin linkReport SubmissionA report that answers all the questions in Section 2 including all the necessary SQLstatements and screenshots of their outputs.2. StudentID.sql: (replacing StudentID) Submit on Blackboard via the standardupload link SQL Script SubmissionA plaintext script file that includes all your SQL statements.Your report file should include the following content: Answers to all the Questions in Section 2. If you are asked to write SQL statements, you need to include those statements inyour report. After you execute a SQL statement, if Oracle produces any output (e.g. query result,query execution time, query plan, etc), you should also include a screenshot of theoutput as well. (Note: Please be sensible when including query output. Any outputclose to the size of one page can be shown by just including the first 10 lines andthe last 10 lines. A report that includes multiple pages of a query output will losepresentation marks. You may find some helpful instructions for formatting queryoutput in Practical 2 or the following Oracle documentation) httpss://docs.oracle.com/cd/A57673_01/DOC/server/doc/SP33/ch4.htmYour script file is in plain text format. You must make sure that your script file can beexecuted on the ITEE lab machines by the @ command. The same SQL statementsin your script file should also be copied and pasted into your report file (as explainedabove). Even though the script file does not introduce any new information comparedto the report, it is intended to help the lecturer/tutors to quickly check the correctnessof your SQL statements before checking the details in your report file.Enjoy the project! Good luck!如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导