Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

answer from f and next QUESTION 3-SQL (30 marks) Using the following database formulate SOL statements to satisfy what is requested by the users Primary

answer from f and next
image text in transcribed
QUESTION 3-SQL (30 marks) Using the following database formulate SOL statements to satisfy what is requested by the users Primary keys appear in bold and underlined and foreign key in italics PERSON (Person Name, Name, DOB, DOD, Gender, Address City, Country. Phone, Email) RELATIONSHIP (Persent Person, Relation) Notes. This database was created for an application which will construct a family tree. In PERSON we have data describing each person. DOB is for the Date of Birth and DOD is for the Date of Death. In RELATIONSHIP we have the relationship between every pair of persons eg, father, mother sister, brother, etc. Person and Person2 keep data of type Personi. Relation keeps data such as brother sister, mother, father, etc. and it is always the relation of Person to Persona. For example, (123, 201, Mother) shows Person with code 123 being the mother of Person with code 201 e Select ANY 10 of the following requests to express using SQL (3 marks cach). a) Remove all persons from the PERSON table if they do not telate to any other person b) Prepare a fisting of all persons with their details and Relations). Include persons not related to any other person in the output. Olint: Use OUTER JOIN) Create a view to include Person, Name and Name combined in one columnas Name, and Email of a mother Relation include a check for the persons to be alive as we would like to send them a card for Mother's Day. Exclude any repeated records Using the RELATIONSHIP relation count for each person being a mother Relation the number of children Use a correlated subquery to extract the children (Person 2) which relate to more than one "ather Relation). Display Person and Person2 0 Change the field Phone for the person with PersoniD - 112 to 35799473837 Create a new table named DECEASED to include Person, Name, Fame, DOB, DOD, Gender Country with person as the primary key Copy the records of all deceased persons from PERSON TO DECLASED. Afterwards delete their second from PERSON Oint2 commands Count how many mothers have or more children and display that as "Having children Add a record with your data in the PERSON table Perform a count per country of the number of minors (Age 18) by gender Insert a new required field in PERSON: Nationalty texto. Assign N/Aia the default value fint 3 commande hi il

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

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions