Create a trigger on inproceeding

Assignment Help Database Management System
Reference no: EM132130209

Assignment

Queries, Functions and Triggers

Database Systems

Aims

The aims of this assignment are to:

formulate SQL queries;
populate an RDBMS with a real dataset, and analyse the data;
design test data for testing SQL queries;
create SQL views;
understand the limitations of SQL queries;
create SQL functions (when needed); and
create triggers.

Description

In this assignment, the schema for a simple publication database is provided to you. The file is: pub-schema.sql. Based on the provided schema, you are required to answer the following questions by formulating SQL queries. You may create SQL functions or PLpgSQL to help you, if and only if the standard SQL query language is not expressive and powerful enough to satisfy a particular question. To enable auto-marking, your queries should be formulated as SQL views, using the view names and attribute names provided. Since this assignment is auto-marked, using different view names and/or attribute names from the provided names may result in losing part or all of the marks for the questions involved. If any answer requires you to output a calculated value that has decimals, you should round it to an integer.

1. List all the editors.
create or replace view Q1(Name) as ...

2. List all the editors that have authored a paper.
create or replace view Q2(Name) as ...

3. List all the editors that have authored a paper in the proceeding that they have edited.
create or replace view Q3(Name) as ...

4. For all editors that have authored a paper in a proceeding that they have edited, list the title of those papers.
create or replace view Q4(Title) as ...

5. Find the title of all papers authored by an author with last name "Clark".
create or replace view Q5(Title) as ...

6. List the total number of papers published in each year, ordered by year in ascending order. Do not include papers with an unknown year of publication. Also do not include years with no publication.
create or replace view Q6(Year, Total) as ...

7. Find the most common publisher(s) (the name). (i.e., the publisher that has published the maximum total number of papers in the database).
create or replace view Q7(Name) as ...

8. Find the author(s) that co-authors the most papers (output the name). If there is more than one author with the same maximum number of co-authorships, output all of them.
create or replace view Q8(Name) as ...

9. Find all the author names that never co-author (i.e., always published a paper as a sole author).
create or replace view Q9(Name) as ...

10. For each author, list their total number of co-authors, ordered by the total number of co-authors in descending order, followed by author names in ascending order. For authors that never co-author, their total is 0. For example, assume John has written 2 papers so far: one with Jane, Peter; and one with Jane, David. Then the total number of co-authors for John is 3. In other words, it is the number of people that have written papers with John.
create or replace view Q10(Name, Total) as ...

11. Find all the author names that have never co-authored with any co-author of Richard (i.e. Richard is the author's first name), nor co-authored with Richard himself.
create or replace view Q11(Name) as ...

12. Output all the authors that have co-authored with or are indirectly linked to Richard (i.e. Richard is the author's first name). We define that a is indirectly linked to b if there exists a C p1, p1 C p2,..., pn C b, where x C y means x is co-authored with y.
create or replace view Q12(Name) as ...

13. Output the authors name, their total number of publications, the first year they published, and the last year they published. Your output should be ordered by the total number of publications in descending order and then by name in ascending order. If none of their publications have year information, the word "unknown" should be output for both first and last years of their publications.
create or replace view Q13(Author, Total, FirstYear, LastYear) as ...

14. Suppose that all papers that are in the database research area either contain the word or substring "data" (case insensitive) in their title or in a proceeding that contains the word or substring "data". Find the number of authors that are in the database research area. (We only count the number of authors and will not include an editor that has never published a paper in the database research area).
create or replace view Q14(Total) as ...

15. Output the following information for all proceedings: editor name, title, publisher name, year, total number of papers in the proceeding. Your output should be ordered by the total number of papers in the proceeding in descending order, then by the year in ascending order, then by the title in ascending order.
create or replace view Q15(EditorName, Title, PublisherName, Year, Total) as ...

16. Output the author names that have never co-authored (i.e., always published a paper as a sole author) nor edited a proceeding.
create or replace view Q16(Name) as ...

17. Output the author name, and the total number of proceedings in which the author has at least one paper published, ordered by the total number of proceedings in descending order, and then by the author name in ascending order.
create or replace view Q17(Name, Total) as ...

18. Count the number of publications per author and output the minimum, average and maximum count per author for the database. Do not include papers that are not published in any proceedings.
create or replace view Q18(MinPub, AvgPub, MaxPub) as ...

19. Count the number of publications per proceeding and output the minimum, average and maximum count per proceeding for the database.
create or replace view Q19(MinPub, AvgPub, MaxPub) as ...

20. Create a trigger on RelationPersonInProceeding, to check and disallow any insert or update of a paper in the RelationPersonInProceeding table from an author that is also the editor of the proceeding in which the paper has published.

21. Create a trigger on Proceeding to check and disallow any insert or update of a proceeding in the Proceeding table with an editor that is also the author of at least one of the papers in the proceeding.

22. Create a trigger on InProceeding to check and disallow any insert or update of a proceeding in the InProceeding table with an editor of the proceeding that is also the author of at least one of the papers in the proceeding.

Reference no: EM132130209

Questions Cloud

Explain the definition of quantitative methods : The two most common research methods are qualitative and quantitative. We learned about qualitative research in Unit III. Unit IV is all about quantitative.
What are your recommendations as a strategist : Apply the following framework (on the next page) on three companies of your choice which are operating in the same industry/industries and produce a table.
Explain the reason of the advertisement : What you have to do is to talk about an american ad for example burger king or something and it's two paragraphs just explain the reason of the advertisement.
Define integral component of the remaining activities : For this assignment, you will use the "Business Problem Statement" template to organize your problem statement. This will help you identify your business.
Create a trigger on inproceeding : Create a trigger on InProceeding to check and disallow any insert or update of a proceeding in the InProceeding table with an editor of the proceeding
Identify the event or individual being represented in each : If dealing with portraiture, do the sculptures seem to convey personality? If so, how? Identify the event or individual being represented in each work.
Discuss what the cats overall role is in egyptian culture : You are either an Egyptian priest or priestess of Bastet, a member of the Egyptian Royal Family, a scribe in charge of grain supplies, or a farmer in Ancient.
What are the main points of sex and caste : How do you think the points you discussed in part a relate to the employment ads and the protest of the Miss America pageant? (written and visual sources)
What two treaties did franklin ultimately get france : How was he received there? Was he liked and, if so, why? What reasons did France have for favoring the Colonies over England in the war?

Reviews

len2130209

10/3/2018 6:01:35 AM

Make sure you read the above description thoroughly, and review and/or test out the provided schema pub-schema.sql and sample data pub-insert.sql. The sample data is provided to help you quickly get started. While the same schema will be used to test your submission, a different dataset (that may be larger, smaller, or totally different) will be used for auto-marking. Therefore, you may need to create your own or modify the provided data file to test your queries before submitting your assignment. Note that you do not need to submit your data file as part of the submission. If any aspect of this assignment specification requires further clarification, ask for it under the section Assignments/Assignment 2/Assignment 2 on the course website Forums.

len2130209

10/3/2018 6:01:27 AM

This assignment is worth a total of 15 marks. Your submission (in a file called a2.sql) will be auto-marked to check: whether it is syntactically correct; if using SQL queries without creating a function or PLpgSQL unless it is necessary; and of course, if each query produces correct results. Queries are worth equal marks. Also, documentation and coding style (e.g., comments, naming of variable/aliases) will be considered while marking.

len2130209

10/3/2018 6:01:19 AM

For fairness to all students in the class, no special considerations will be given to those: who claim to have submitted their assignment but the assignment has not been received by the give system above (use the "classrun" command to check if your assignment has been submitted, e.g., "9311 classrun -check a2"); who submit their assignment a few minutes late and request to be considered as non-late submissions (please do submit your assignment early in case of your network connection problem, computer breakdown, etc); who claim that their assignments worked perfectly on their home computers but somehow did not work on CSE Linux machines (we will only test and mark your assignments on CSE Linux machines, and will not consider the results on your own machines. Hence, please test your assignments on CSE Linux machines before submission).

Write a Review

Database Management System Questions & Answers

  What is a trigger

What is a trigger

  Under which conditions would each type of loop be more

there are 3 kinds of loops-for loop while loop and do while loop. under which circumstances would each kind of loop be

  Interaction in a tic-tac-toe game

Write a PhoneContact class that gets initialized with a phone number and a label. The phone number should follow one of the formats of the Phone class from the previous assignment (and you should use the Phone class in this assignment).

  Write the relational schema

Write the relational schema, draw its dependency diagram, and identify all dependencies, including all partial and transitive dependencies.

  Search and set up the national parks database

create a table named Park. Accept the default ID primary key field with the AutoNumber data type, renaming it as Park ID. Enter at least five additional fields, such as Name, State, Fee, Hours

  Use an entity relationship diagram to define the structure

Use an entity relationship diagram to define the structure of the system.

  Describe use case dependency for making an account transfer

Describe (in a one to two page narrative) a use case dependency for making an account transfer. Illustrate this use case with Visio or a similar product.

  Create database applications that interface the internet

Create database applications that interface the internet. The document should be written to the CEO of a ficticious company or company of your choice.

  Decompose the home library relation

Draw a dependency diagram to show the functional dependencies that exist in this relation - Decompose the Home Library relation into a set of 3NF relations

  Why is a key important in a database

Why is a Key important in a database? How does it help with Referential Integrity? Lists three compelling reasons why Keys are crucial to table structure

  Which of the threats should you take action on

A qualitative threat assessment of the computer security of yourOrganization, with the impacts and probabilities of occurrence listed in the below table.

  What is an ideal value of k for the vehicle silhouettes data

What is an ideal value of k for the Vehicle Silhouettes data? This is a subjective and open-ended question.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd