Database Assignment Help

Database Task on Baby Names

— Query 1 —

SELECT
SUM(number) AS record_count
FROM
`bigquery-public-data.usa_names.usa_1910_2013`
— Query 2 —

SELECT
gender,
SUM(number) AS total_births
FROM
`bigquery-public-data.usa_names.usa_1910_2013`
GROUP BY
gender
ORDER BY
gender DESC

— Query 3 —

SELECT
MIN(number) AS fewest_num,
AVG(number) AS avg_num,
MAX(number) AS most_num
FROM
`bigquery-public-data.usa_names.usa_1910_2013`
GROUP BY
state
ORDER BY
most_num ASC

— Query 4 —

SELECT
name
FROM
`bigquery-public-data.usa_names.usa_1910_2013`

GROUP BY
name, state
HAVING MAX(number) = 5 and state=’LA’
ORDER BY name LIMIT 1
— Query 5 —

SELECT
(SELECT name FROM `bigquery-public-data.usa_names.usa_1910_2013` WHERE state=’Florida’ GROUP BY name ORDER by MAX(number) LIMIT 1) as name, COUNT(number) AS total
FROM
`bigquery-public-data.usa_names.usa_1910_2013`
GROUP BY name
order BY
total