Question

Write the following questions as queries in SQL. Use only the operators discussed in class (in...

Write the following questions as queries in SQL. Use only the operators discussed in class (in particular, no outer joins are allowed). Please use renaming consistently! The following database schema is given:

RESEARCHER(rid,name,institution,city,country)

PAPER(title,journal,volume,number,year)

AUTHOR(resid,title)

where rid is the identifier (primary key) of RESEARCHER, name is the researcher’s name, institution is where the researcher works, and city and country the city and country where the institution is located; title is the paper identifier (primary key) of PAPER, journal is the journal where it was published (in volume volume and number number), and year is the year it appeared. Finally, in AUTHOR resid is a foreign key for RESEARCHER and title is a foreign key for PAPER. A researcher may write several papers, and papers may be jointly written by several researchers; this means that the key of Author is (resid,title).

1. List the names of authors of any paper published in journal “Databases” in 2019 in volume 12.

2. List the names of authors who have published a paper in both “Nature” and in “Science” (journals).

3. List the names of authors who have published two or more papers in “Nature” (journal).

4. List the names of authors who have published a paper in “Nature” but never in “Science” (journals).

5. List the names of authors who have published a paper in “Nature” (journal) alone (i.e. without co-authors).

6. List the title of papers where all authors are from the same institution. Note: this includes sole authors too.

7. Find out the average number of authors per paper.

8. Find out the number of papers per country (count each paper once, regardless of the number of authors).

9. List the number of papers per author (identified by author id) but count each paper in proportion to the number of authors. That is, if a paper has n authors, split the credit equally among them (1/n units of credit). Example: if researcher Ullman has 3 papers, one alone, one with somebody else, and one with two other co-authors, he gets 1, .5 and .3 units of credit respectively, for a total of 1.8 papers.

10. List the journals that published more papers in 2019 than in 2018.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) select r.name from AUTHOR a, PAPER p, RESEARCHER r where a.resid = r.rid and a.title = p.title and p.journal = 'Databases' and p.year = 2019 and p.volume = 12;

2)

select r.name from AUTHOR a, PAPER p, RESEARCHER r where a.resid = r.rid and a.title = p.title and p.journal = 'Nature'

INTERSECT

select r.name from AUTHOR a, PAPER p, RESEARCHER r where a.resid = r.rid and a.title = p.title and p.journal = 'Science';

3)

select r.name from AUTHOR a, PAPER p, RESEARCHER r where a.resid = r.rid and a.title = p.title and p.journal = 'Nature' GROUP BY r.name having count(*) > 1;

4)

select r.name from AUTHOR a, PAPER p, RESEARCHER r where a.resid = r.rid and a.title = p.title and p.journal = 'Nature'

minus

select r.name from AUTHOR a, PAPER p, RESEARCHER r where a.resid = r.rid and a.title = p.title and p.journal = 'Science';

NOTE: As per Chegg policy I am allowed to answer specific number of questions (including sub-parts) on a single post. Kindly post the remaining questions separately and I will try to answer them. Sorry for the inconvenience caused.

Add a comment
Know the answer?
Add Answer to:
Write the following questions as queries in SQL. Use only the operators discussed in class (in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This assignment consists of a series of SQL questions. For each question, you will need to...

    This assignment consists of a series of SQL questions. For each question, you will need to include: • SQL query. • An explanation of the query. Please include explanations as a comment AFTER your query, e.g., enclosed within a /* comments block */ ). See the first example in the SQL tutorial for a comment. You don’t need to explain straightforward code in comments. Only the parts that are interesting or different, so that we understand what you did. Question-1...

  • Consider the computer science bibliography domain described in Lab Assignment 1. Consider the schema in Figure...

    Consider the computer science bibliography domain described in Lab Assignment 1. Consider the schema in Figure to model this domai Each author in table Authors is identified by a unique authorID which is autogenerated. Each author has a first name, a last name and an email. The email is unique, while the first name and last name may not be unique. Each paper is identified by a unique papeD which is autogenerated. For each paper, we keep in table Papers...

  • Question 3. SQL (5 points). In addition to the lecture notes, you should also study by yourself t...

    Question 3. SQL (5 points). In addition to the lecture notes, you should also study by yourself the SQL Plus tutorial on Canvas (the Oracle section) and other resources for Oracle syntax and useful functions. The relational schema for the Academics database is as follows: DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode) ACADEMIC(acnum, deptnum, famname, givename, initials, title) PAPER(panum, title) AUTHOR(panum*. acnum) FIELD(fieldnum, id, title) INTEREST(fieldnum* acnum*, descrip) Some notes on the Academics database An academic department belongs to one institution...

  • Please read the following situation and construct an E-R diagram, using the concepts we learnt in...

    Please read the following situation and construct an E-R diagram, using the concepts we learnt in class. We should use a computer graphing package, such as MS Powerpoint, to construct the E-R diagram, so it looks professional. Turn in a hard copy of the sketch at the due time. . POP organization: The POP (publish-or-perish) organization publishes several academic journals. They would like us to build them a database system, to help manage their business. As a first step, you...

  • May I ask the SQL code as follows? The relational database moviedb has the following database...

    May I ask the SQL code as follows? The relational database moviedb has the following database schema: Movie(title, production year, country, run time, major genre) primary key : {title, production year} Person(id, first name, last name, year born) primary key : {id} Award(award name, institution, country) primary key : {award name} Restriction Category(description, country) primary key : {description, country} Director(id, title, production year) primary key : {title, production year} foreign keys : [title, production year] ⊆ Movie[title, production year] [id]...

  • Write the following SQL statements in Microsoft Access by using the Books database from Week 2...

    Write the following SQL statements in Microsoft Access by using the Books database from Week 2 Assignment 2. Once complete, copy and paste the SQL statements in a Microsoft Word document: Write SQL statements: To update the publisher name from READ WITH US to READ FOR US To verify the updated name field for the publisher with ID 6 To make the following updates to the Publisher table (be careful with WHERE): Make Contact="John Travolta" for publisher with ID number...

  • Use the SQL statements provided to create your tables. Write one SQL statement for each of...

    Use the SQL statements provided to create your tables. Write one SQL statement for each of the following problems. You can only use the conditions listed in the tasks. E.g., in task 1, you cannot manually look up pid of Information Systems undergraduate program. Here is the given code: drop table textbook_schedule cascade constraints; drop table textbook_author cascade constraints; drop table schedule cascade constraints; drop table course cascade constraints; drop table textbook cascade constraints; drop table author cascade constraints; drop...

  • The primary keys are underlined. The foreign keys are denoted by asterisks (*). Description of the...

    The primary keys are underlined. The foreign keys are denoted by asterisks (*). Description of the schema: • person — keeps track of the people who borrow books from the library. The attributes contain personal and contact information. • author — keeps track of personal information about authors. • publisher — keeps track of the publisher information. To keep it simple, most of the attributes have been truncated in the sample database. 1 trivial dependencies are things like X→X or...

  • Please help me on the SQL queries, thank you so much. Write a query to display the title and publisher as well as the p...

    Please help me on the SQL queries, thank you so much. Write a query to display the title and publisher as well as the publisher contact for each book using JOIN...USING clause. Write a query to show the first and last names of customers who have ordered cooking books. Use the WHERE clause to join the tables. Write a query to show the title, cost and ISBN of each book in the books table. If the book has been ordered,...

  • Chapter 10 Test B 10-7 Section 10.3 (Reading Research Papers) Use the following information to answer questions (16) and (17). A researcher wonders whether speed of service at a diner is affected...

    Chapter 10 Test B 10-7 Section 10.3 (Reading Research Papers) Use the following information to answer questions (16) and (17). A researcher wonders whether speed of service at a diner is affected by whether a male customer is wearing a suit jacket. The researcher used the following study design to collect data: The researcher chose five diners in a large city and recorded the number of male customers who wore a suit jacket during a two week period. He also...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT