Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I've been given the following problem. I understand very basic SQL (select, join, etc.) but some of this is over my head. Here are sample
I've been given the following problem. I understand very basic SQL (select, join, etc.) but some of this is over my head.
Here are sample rows from 3 tables with data about parents at a preschool. Some parents are gathering names for an after-school parents club. We have two tasks, but first, we need to keep the following in mind: a) If a person's name appears twice, it's an accident. Only include the one with the later birth year. b) We don't want any NULL entries. c) We don't want to consider any parents from the "no interest" table. Table1: kids Parent | children John | 3 Martha 12 Andrea 11 Susie | 2 Maggie | 5 Table2: ages name | birthyear. Andrea Andrea Susie Maggie John | 1985 1980 1983 1990 NULL Table3: no interest name Susie Joe Linda Tasks: 1. Create a distribution of birth year by percentage of total number of parents. Do not include NULL values in either input or output. 2. Create a table showing the average number of kids per visitor, but only for parents with names starting with the letter J (upper/Lower case doesn't matter). Within this table we want a column that shows whether the parents have over 2 kids (1=True, O=False). Sort this table by average number of kids in descending order. Here are sample rows from 3 tables with data about parents at a preschool. Some parents are gathering names for an after-school parents club. We have two tasks, but first, we need to keep the following in mind: a) If a person's name appears twice, it's an accident. Only include the one with the later birth year. b) We don't want any NULL entries. c) We don't want to consider any parents from the "no interest" table. Table1: kids Parent | children John | 3 Martha 12 Andrea 11 Susie | 2 Maggie | 5 Table2: ages name | birthyear. Andrea Andrea Susie Maggie John | 1985 1980 1983 1990 NULL Table3: no interest name Susie Joe Linda Tasks: 1. Create a distribution of birth year by percentage of total number of parents. Do not include NULL values in either input or output. 2. Create a table showing the average number of kids per visitor, but only for parents with names starting with the letter J (upper/Lower case doesn't matter). Within this table we want a column that shows whether the parents have over 2 kids (1=True, O=False). Sort this table by average number of kids in descending orderStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started