Question 1 Consider the following relations with key underlined: Lives (person name, street, city) Works (person name, company_name, salary) Located (company name, city) Manages (person name, manager_name) Answer the following using SQL: a) Define the schema for relation Works in SQL, note that company name is foreign key. Specify constraint that salary should not be less than 10,000cedis. Find the names and city of persons who work for manager John. Find the names of persons who earn more than the average salary. John's manager has changed. The new manager is Anna. Remove all people whose name start with the letter 'S' from the database. List the number of companies in each city, in descending order by number. Who are the managers and for which company do they work? Add a new text column called Country to the Located table. b) c) d) f) g) h) i) j) Find how many people in each company earn more than GHC20,000 Create a view CapeWork (person_name, company_name) of all people who work in Cape Coast in ascending order of person name.

Database Systems: Design, Implementation, & Management
11th Edition
ISBN:9781285196145
Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Chapter7: Introduction To Structured Query Language (sql)
Section: Chapter Questions
Problem 65C: Write the SQL code to create the table structures for the entities shown in Figure P7.65. The...
icon
Related questions
icon
Concept explainers
Question

1

DCIT 305 Fundamentals of Databases
Question 1
Consider the following relations with key underlined:
Lives (person name, street, city)
Answer the following using SQL:
a) Define the schema for relation Works in SQL, note that company name is foreign key.
Specify constraint that salary should not be less than 10,000cedis.
Find the names and city of persons who work for manager John.
Find the names of persons who earn more than the average salary.
John's manager has changed. The new manager is Anna.
Remove all people whose name start with the letter 'S' from the database.
List the number of companies in each city, in descending order by number.
Who are the managers and for which company do they work?
Add a new text column called Country to the Located table.
b)
c)
d)
f)
Works (person name, company_name, salary)
Located (company name, city)
Manages (person name, manager_name)
h)
i)
j)
Find how many people in each company earn more than GHc20,000
Create a view CapeWork (person_name, company_name) of all people who work in Cape
Coast in ascending order of person name.
Transcribed Image Text:DCIT 305 Fundamentals of Databases Question 1 Consider the following relations with key underlined: Lives (person name, street, city) Answer the following using SQL: a) Define the schema for relation Works in SQL, note that company name is foreign key. Specify constraint that salary should not be less than 10,000cedis. Find the names and city of persons who work for manager John. Find the names of persons who earn more than the average salary. John's manager has changed. The new manager is Anna. Remove all people whose name start with the letter 'S' from the database. List the number of companies in each city, in descending order by number. Who are the managers and for which company do they work? Add a new text column called Country to the Located table. b) c) d) f) Works (person name, company_name, salary) Located (company name, city) Manages (person name, manager_name) h) i) j) Find how many people in each company earn more than GHc20,000 Create a view CapeWork (person_name, company_name) of all people who work in Cape Coast in ascending order of person name.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Query Syntax
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning