Question

In: Computer Science

The schema for the Academics database is as follows. Understanding this schema is necessary to answer...

The schema for the Academics database is as follows. Understanding this schema is necessary to answer the questions in Part B.

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) 

The semantics of most attributes are self-explanatory. For each relation, the primary key is underlined and any foreign keys are denoted by an asterisk (*). Some additional information for relations is given below:

  • DEPARTMENT: Each academic department (deptnum) belongs to an institution (instname).  
  • ACADEMIC: Each academic (acnum) belongs to one department (deptnum).  
  • AUTHOR: A paper (panum) may be written by more than one academic (acnum).  
  • FIELD: The relation describes research areas, where id is a classification code like B.1.1.  
  • INTEREST: The relation describes that an academic may have research interests in several fields (fieldnum), and provide description (descrip) of his/her research.

Question1 SQL

calculate the number of academics that have more than 10 papers?

Question 2 SQL

find the departments where at most 10 academics have more than 2 research fields, and display in alphabetical order the names of institutions and names of departments?

Solutions

Expert Solution

Schema of table:-

CREATE TABLE DEPARTMENT(deptnum int primary key, descrip text, instname varchar(30), deptname varchar(20), state varchar(15), postcode number);

CREATE TABLE ACADEMIC(acnum int primary key, deptnum int not null, famname varchar(15), givename varchar(15), initials text, title varchar(15),FOREIGN KEY (deptnum) REFERENCES DEPARTMENT(deptnum));

CREATE TABLE PAPER(panum int primary key , title varchar(15));


CREATE TABLE AUTHOR(panum int not null, acnum int not null,FOREIGN KEY (panum) REFERENCES PAPER(panum),FOREIGN KEY (acnum) REFERENCES ACADEMIC(acnum));


CREATE TABLE FIELD(fieldnum int primary key, id int not null, title text);

CREATE TABLE INTEREST(fieldnum int not null, acnum int not null, descrip text,FOREIGN KEY (fieldnum) REFERENCES FIELD(fieldnum),FOREIGN KEY (acnum) REFERENCES ACADEMIC(acnum));

Insert sample value as we required to show sample output:-

insert into ACADEMIC values(101,8,null,null,null,null);
insert into AUTHOR values(11,101);

insert into INTEREST values(5,101,null);
insert into DEPARTMENT values(8,null,"IIT","Chemical",null,null);

Question1:- calculate the number of academics that have more than 10 papers?

Answer: - select * from ACADEMIC as A,AUTHOR as B where A.acnum==B.acnum and panum>10;

Question2: - find the departments where at most 10 academics have more than 2 research fields, and display in alphabetical order the names of institutions and names of departments?

Answer: - select instname,deptname,fieldnum from DEPARTMENT as D,ACADEMIC as A,INTEREST as I where D.deptnum==A.deptnum and A.acnum==I.acnum and fieldnum>2 order by instname asc limit 10;


Related Solutions

We use the WMCRM database and here is the summary of the database schema (where schema...
We use the WMCRM database and here is the summary of the database schema (where schema is used in its meaning of a summary of the database structure): VEHICLE (InventoryID, Model, VIN) SALESPERSON (NickName, LastName, FirstName, HireDate, WageRate, CommissionRate, OfficePhone, EmailAddress, InventoryID) CUSTOMER (CustomerID, LastName, FirstName, Address, City, State, ZIP, EmailAddress, NickName) PHONE_NUMBER (CustomerID, PhoneNumber, PhoneType) CONTACT(ContactID, CustomerID,ContactDate,ContactType,Remarks) Where InventoryID in SALESPERSON must exist in InventoryID in VEHICLE NickName in CUSTOMER must exist in NickName in SALESPERSON CustomerID in PHONE_NUMBER...
[Q.4] Answer the following questions You are invited as a database architect to develop database schema...
[Q.4] Answer the following questions You are invited as a database architect to develop database schema for maintaining patient information for the NYU medical group (make necessary assumptions for the data requirements if needed). Each physician in the Lehman medical group is uniquely identified by physicianID o Each physician must have first name, and last name, and phone number Each patient is identified by patientID o Each patient must have first name, and last name, phone number, and insurance card...
A database schema consisting of three relations STUDENT, COURSE, and STAFF is created as follows: CREATE...
A database schema consisting of three relations STUDENT, COURSE, and STAFF is created as follows: CREATE TABLE STUDENT (STU_ID CHAR(4), STUDENT_NAME CHAR(20), ADDRESS CHAR(20), BIRTHDATE DATE, GENDER CHAR(6)); CREATE TABLE COURSE (COURSE_ID CHAR(6), COURSE_TITLE CHAR(20), STAFF_ID CHAR(3), SECTION NUMBER(2)); CREATE TABLE STAFF (STAFF_ID CHAR(3), STAFF_NAME CHAR(20), GENDER CHAR(6), DEPARTMENT CHAR(20), BOSS_ID CHAR(3) SALARY NUMBER(8,2)); Write down SQL statement for each query below: 1) Find out the information of staff members who are female and earn either below $5,000 or above...
For the given database schema. Answer the following questions. Company Database customer(cust_id, name, address) product(product_id, product_name,...
For the given database schema. Answer the following questions. Company Database customer(cust_id, name, address) product(product_id, product_name, price, quantity) transaction(trans_id, cust_id, time_date) product_trans(product_id, trans_id) Identify the primary keys and foreign keys for the relations and specify at least two different types of integrity constraints that would be applicable for different relations given.
When is the conceptual schema of a database changed?- if we update data in the database...
When is the conceptual schema of a database changed?- if we update data in the database -if we alter the logical structure of the database -if we retrieve data from the database -if we alter the storage structure of the database Which of the following has the same meaning as the outer union? Group of answer choices -the left outer (natural) join -the right outer (natural) join -the full outer (natural) join -the inner (natural) join Assume {A, B} is...
Given the same simple Employee-Workson-Project database schema , which contains three files described as follows:
Given the same simple Employee-Workson-Project database schema , which contains three files described as follows:Emp (eid : integer, ename : string, age : integer, salary: real)Workson (eid : integer, pid : integer, hours : integer)Project (pid : integer, pname : string, budget : real, managerid : integer)Note : eid, ename, age and salary are the employee id, name, age and salary respectively. Also, hours is the number of hours worked by employee on a project. The rest of the attributes...
Write a javascript code to check if the JSON body follows the schema. schema is {...
Write a javascript code to check if the JSON body follows the schema. schema is {     "name":"john doe",     "mood":"happy"     "major":"cs",     "date":"2024" } json body is {     "name":"john doe", "height":"170cm"     "major":"cs",     "date":"2024" } the result should be false
• Relational Schema Create a relational database schema consisting of the four relation schemas representing various...
• Relational Schema Create a relational database schema consisting of the four relation schemas representing various entities recorded by a furniture company.   Write CREATE TABLE statements for the following four relation schemas. Define all necessary attributes, domains, and primary and foreign keys. Customer(CustomerID, Name, Address) FullOrder(OrderID, OrderDate, CustomerID) Request(OrderID, ProductID, Quantity) Product(ProductID, Description, Finish, Price) You should assume the following: Each CustomerID is a number with at most three digits, each OrderID is a number with at most five digits,...
Need an example of a database schema for an online or ecommerce store and an explanation...
Need an example of a database schema for an online or ecommerce store and an explanation of the how it functions
Answer the questions in detail: 1. What tasks are necessary to keep a database functional? 2....
Answer the questions in detail: 1. What tasks are necessary to keep a database functional? 2. How do you schedule backups to safeguard data? How do you know/differentiate  what data should be and what data needs to be backed up? 3. What can you do to keep a database working efficiently? What does it mean to have an efficient database?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT