Question: CREATE TABLE Person ( PersonID Number PRIMARY KEY, Name Char ( 4 5 ) Gender Char ( 1 ) ) ; CREATE TABLE Parent (
CREATE TABLE Person
PersonID Number PRIMARY KEY,
Name Char
Gender Char
;
CREATE TABLE Parent
ParentID Number,
ChildID Number
;
CREATE TABLE Spouse
SpouseID Number,
SpouseID Number
;
INSERT INTO Person VALUES E MF;
INSERT INTO Person VALUES R TF;
INSERT INTO Person VALUES Z TM;
INSERT INTO Person VALUES S TM;
INSERT INTO Person VALUES B MM;
INSERT INTO Person VALUES C GF;
INSERT INTO Person VALUES R MF;
INSERT INTO Person VALUES J MM;
INSERT INTO Person VALUES C MM;
INSERT INTO Person VALUES S MM;
INSERT INTO Person VALUES J MM;
INSERT INTO Person VALUES N BF;
INSERT INTO Person VALUES J MF;
INSERT INTO Person VALUES S GF;
INSERT INTO Person VALUES L GM;
INSERT INTO Person VALUES D VF;
INSERT INTO Person VALUES J VM;
INSERT INTO Person VALUES K VF;
INSERT INTO Person VALUES R VM;
INSERT INTO Parent VALUES ;
INSERT INTO Parent VALUES ;
INSERT INTO Parent VALUES ;
INSERT INTO Parent VALUES ;
INSERT INTO Parent VALUES ;
INSERT INTO Parent VALUES ;
INSERT INTO Spouse VALUES ;
INSERT INTO Spouse VALUES ;
INSERT INTO Spouse VALUES ;
Using these tables Write:
b a query to return the two parents of each child if you arent careful, the rows will show up twice
cYou notice there might be siblings in there. Instead or returning the pair of parents for each child, modify the query to return pairs of people who have at least one child together.
dExtend the prior query to count how many children they have together
eWrite a query to connect each female in the dataset to her children one child per row If she has no children, it should return NULL.
fWrite a query to determine if each mother has a spouse. If they do not have a spouse, the return should be NULL.
gWrite a query to determine all of the grandsons.
hUsing a semijoin, determine all the People who are fathers.
iUsing an antijoin, determine all of the unwed people.
jDetermine all brothersister combinations.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
