Question

In: Computer Science

schema: Student( studID, name, major )   // dimension table, studID is key Instructor( instID, dept );  ...

schema:
Student( studID, name, major )   // dimension table, studID is key
Instructor( instID, dept );   // dimension table, instID is key
Class( classID, univ, region, country );   // dimension table, classID is key
Took( studID, instID, classID, score );   // fact table, foreign key references to dimension tables

Write a SQL query to find all students who took a class from an instructor not in the student's major department and got a score over 80.

Return the student name, instructor name, and score. ,

Please describe in sentences what you need to do to find this information

Solutions

Expert Solution

Note:name is missing in Instructor table,so we will add name column to Instructor table.

For this query You have to follow the steps as:

step-1.First of all you need the information from more than one table.Because student name is in student table,Instructor name is in Instructor table and score is in took table.so,You have to join 3 tables.

step-2.For joining tables you have to find same columns in two tables.Here.Student and Took table has same column StudID .Instructor and Took has same column InstID.

step-3.Now,as given in the question,Your conditions will be

1).Major of student and department of instructor should not be equal &

2).Score should be above 80

step-4.From this result you have to SELECT studID from Student table,instID from Intructor table and score from Took table.   

If you want SQL query for the same,Here it is:

SELECT Student.name,Instructor.name,Took.score

FROM ((Student INNER JOIN Took ON Student.studID=Took.studID)INNER JOIN Instructor ON Took.instID=Instructor.InstID)

WHERE Student.major != Instructor.dept

AND Took.score > 80;


Related Solutions

Which of the following best describes a dimension table in a star schema: Most attributes will...
Which of the following best describes a dimension table in a star schema: Most attributes will likely be text Most attributes will likely be numeric The primary key should be a single integer surrogate key Both a. and c. Which of the following best describes a fact table in a star schema: Most attributes will likely be text Most attributes will likely be numeric The primary key should be a single integer surrogate key Both a. and c. Which of...
ENCORE HYDRAULICS DEPARTMENT STAFFING REPORT DEPT NO: 100                          DEPT NAME:    Administ
ENCORE HYDRAULICS DEPARTMENT STAFFING REPORT DEPT NO: 100                          DEPT NAME:    Administration               MANAGER: Simon Semple        EMP NO: 48                             LOCATION: 1991 Leslie, Toronto EMP NAME                              EMP NO                       POSITION CODE     POSITION Nadia Betz                                22                                            C                      Clerk Raoul Radniski                         12                                            A                      Accountant John Smith                               14                                            S                      Supervisor Raj Singh                                 31                                            C                      Clerk DEPT NO: 200                          DEPT NAME:    Hydraulics                    MANAGER: A. Martinez            EMP NO: 16                             LOCATION:      1241 Main St, Ajax EMP NAME                              EMP NO                       POSITION CODE          POSITION Lee Goldman                            25                                            E                      Engineer Paul Prentiss                            15                                            E                      Engineer Leah Zeltserman                       36                                            EA                    Engineering Assistant Mark Wong                               8                                              S                      Supervisor … Normalize above user view. Document all steps including UNF, 1NF, Dependencies, 2NF, and 3NF.
The following table contains the measurements of the key length dimension from a fuel injector. These...
The following table contains the measurements of the key length dimension from a fuel injector. These samples were taken at one-hour intervals. Construct a three-sigma X ̅-chart and R-chart for the length of the fuel injector. What can you say about this process? Sample Number Observations 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 0.57 0.70 0.61 0.67 0.20 0.51 0.95 0.23 0.24 0.59 0.70 0.04 0.05...
The following table contains the measurements of the key length dimension from a fuel injector. These...
The following table contains the measurements of the key length dimension from a fuel injector. These samples of size five were taken at one-hour intervals. Use three-sigma control limits. Use Exhibit 10.13. OBSERVATIONS SAMPLE NUMBER 1 2 3 4 5 1 0.488 0.485 0.482 0.508 0.485 2 0.501 0.504 0.518 0.491 0.526 3 0.498 0.481 0.513 0.483 0.515 4 0.497 0.504 0.482 0.485 0.486 5 0.474 0.498 0.524 0.460 0.486 6 0.475 0.485 0.505 0.482 0.497 7 0.497 0.512 0.485...
The following table contains the measurements of the key length dimension from a fuel injector. These...
The following table contains the measurements of the key length dimension from a fuel injector. These samples of size five were taken at one-hour intervals. Use three-sigma control limits. Use Exhibit 10.13. OBSERVATIONS SAMPLE NUMBER 1 2 3 4 5 1 0.465 0.494 0.493 0.511 0.472 2 0.471 0.501 0.505 0.484 0.515 3 0.472 0.493 0.516 0.493 0.528 4 0.475 0.501 0.495 0.494 0.492 5 0.481 0.498 0.523 0.457 0.485 6 0.472 0.496 0.502 0.495 0.505 7 0.494 0.502 0.494...
You are to construct a star schema for Simplified Automobile Insurance Company. The relevant dimensions, dimension attributes, and dimension sizes are as follows:
Modern Database Management, 13th EditionJeff Hoffer9-39. You are to construct a star schema for Simplified Automobile Insurance Company. The relevant dimensions, dimension attributes, and dimension sizes are as follows:InsuredPartyAttributes: InsuredPartyID and Name. There is an average of two insured parties for each policy and covered item.CoverageItemAttributes: CoverageKey and Description. There is an average of 10 covered items per policy.AgentAttributes: AgentID and AgentName. There is one agent for each policy and covered item.PolicyAttributes: PolicyID and Type. The company has approximately 1...
Problem 10-29 (Algo) The following table contains the measurements of the key length dimension from a...
Problem 10-29 (Algo) The following table contains the measurements of the key length dimension from a fuel injector. These samples of size five were taken at one-hour intervals. Use three-sigma control limits. Use Exhibit 10.13. OBSERVATIONS SAMPLE NUMBER 1 2 3 4 5 1 0.481 0.486 0.492 0.517 0.475 2 0.485 0.505 0.527 0.491 0.528 3 0.486 0.487 0.513 0.487 0.524 4 0.481 0.505 0.468 0.486 0.486 5 0.467 0.503 0.512 0.468 0.479 6 0.468 0.493 0.502 0.491 0.508 7...
Consider the following SQL DDL statements: CREATE TABLE DEPT ( did INTEGER, dname VARCHAR(20), PRIMARY KEY(did));...
Consider the following SQL DDL statements: CREATE TABLE DEPT ( did INTEGER, dname VARCHAR(20), PRIMARY KEY(did)); CREATE TABLE EMP( eid INTEGER, name VARCHAR(20), did INTEGER, PRIMARY KEY(eid), FOREIGN KEY(did) REFERENCES DEPT); In the database created by above statements, which of the following operations may cause violation of referential integrity constraints? Question 1 options: UPDATE on DEPT INSERT into DEPT DELETE on EMP Both DELETE on EMP and INSERT into DEPT
How does a snowflake schema differ from a STAR schema? Name two advantages and two disadvantages...
How does a snowflake schema differ from a STAR schema? Name two advantages and two disadvantages of the snowflake schema.
Student Name and ID no. _________________________________________________________ Write the journal entries in the given table for below...
Student Name and ID no. _________________________________________________________ Write the journal entries in the given table for below transactions of Clean Corporation during June 2020. 1 Provided services to customers on account for $650. 2 Purchased a building using 10 year Note Payable for $200,000. 3 Paid salaries to employees, $2,600. 4 Received payment from customers to whom service was given in transaction 1 5 Paid $400 dividends to shareholders. Answer Accounts Debit Credit 1 2 3 4 5
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT