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 (instname) and often has many academics. An academic only works for one department. ● Research papers (PAPER) are often authored by several academics, and of course an academic often writes several papers (AUTHOR). ● A research field (FIELD) often attracts many academics and an academic can have interest in several research fields (INTEREST). Primary keys are underlined and foreign keys are marked with *.
Write ONE SQL query for each question to extract information from the database (except the last two questions).
Do not supply the output of the query or the script used to create the tables. Only the SQL query is required for each question.
2.5) List the number of papers that contain data analysis-related research? (data analysis-related papers are papers whose title contains the word “data” in upper or lower case letters. (it should not be part of a word – eg database etc) [HINT: your query should result in 1 row]
2.6) List the panum and title of papers written by the academic with ‘pr’ occuring in their surname. The list should be in the decreasing order of panum. [HINT: your query should result in 152 rows]
2.7) List the acnum of authors and the “number of papers” they have written, (if they have written at least 40 papers). The list should be ordered from most papers to least. [HINT: your query should result in 9 rows]
2.8) List (in ascending order) the acnum of academics belonging to “CS” departments (departments that have CS in the description). [HINT: your query should result in 228 rows]
2.5
SELECT COUNT(*) AS Num_Of_Papers
FROM PAPER WHERE
title LIKE '%data' AND title LIKE 'data%';
2.6
SELECT PAPER.panum,PAPER.title FROM
PAPER INNER JOIN AUTHOR ON PAPER.panum = AUTHOR.panum
INNER JOIN ACADEMIC ON AUTHOR.acnum = ACADEMIC.acnum
WHERE AUTHOR.famname LIKE '%pr%';
2.7
SELECT AUTHOR.acnum, COUNT(*)
FROM PAPER INNER JOIN AUTHOR ON PAPER.panum = AUTHOR.panum
GROUP BY AUTHOR.acnum
HAVING COUNT(*) > 40
ORDER BY COUNT(*) DESC;
2.8
SELECT ACADEMIC.acnum FROM
ACADEMIC INNER JOIN DEPARTMENT ON
ACADEMIC.deptnum = DEPARTMENT.deptnum
WHERE DEPARTMENT.descrip LIKE '%cs%'
ORDER BY ACADEMIC.acnum ;
The relational schema for the Academics database is as follows: DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode)...
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) FIELD(fieldnum, id, title) INTEREST(fieldnum* acnumk, descrip) Some notes on the Academics database An academic department belongs to one institution (instname) and often has many academics. An academic only works for one department. Research papers (PAPER) are often authored by several academics, and of course an academic often writes several papers (AUTHOR) A research field (FIELD) often...
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) FIELD(fieldnum, id, title) INTEREST(fieldnum* acnumk, descrip) Some notes on the Academics database An academic department belongs to one institution (instname) and often has many academics. An academic only works for one department. Research papers (PAPER) are often authored by several academics, and of course an academic often writes several papers (AUTHOR) A research field (FIELD) often...
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...
Question 3. SQL. 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, dept name, state, postcode) ACADEMIC(acnum, deptnum*, famname, give name, initials, title) PAPER(panum, title) AUTHOR(panum*, acnum*) FIELD(field num, id, title) INTEREST(field num*, acnum*, descrip) Some notes on the Academics database: An academic department belongs to one...
Return the acnum of academic(s) who wrote the largest number of
papers. You must NOT use MAX. An SQL query that lists all academics
in decreasing order of their total number of papers is
incorrect.
Question 1. SQL (10 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 syntax and useful functions The relational schema for the Academics database is as follows descrip,...
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]...
SQL Queries – in this assignment you will be asked to create several SQL queries relating to the Sakila database that we installed in class. You may freely use DBeaver to create these queries, but I will expect your solution to show me the SQL code to answer or complete the tasks below. Write a query that produces the last name, first name, address, district, and phone number for every customer in the customer table. (You don’t need to include...