Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. (a) Define Super Key, Candidate Key, Primary Key and Foreign Key with example data. (b) Consider the following relations: (Note: ID is the primary

image text in transcribed

3. (a) Define Super Key, Candidate Key, Primary Key and Foreign Key with example data. (b) Consider the following relations: (Note: ID is the primary key of each entity. x(FK[r]) idicates x a foreign key referencing entity r): [07] [18] persons(ID, Name, DOB, Address) schools(ID, Name, Establish Year) companies(ID, Name, Location) students(ID, PersonID (FK[persons), gpa, schoolID(FK[schools])) emp(ID, PersonID(FK[persons)), Salary) Now write the standard SQL for the following queries: i. List the persons Name, ID and Address according to their age (i.e. Oldest will appear first) ii. List each student's information as following: Student ID, Student Name, Name of School, gpa iii. List the school's summary as : School Name, Total Students, average gpa iv. List top 5 schools based on the average gpa (as obtained in iii) v. List employees name, his/her company name, salary vi. Update each employees salary by 20% for those who currently get less than the average salary of his/her company's employees salary

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions