0% found this document useful (0 votes)
62 views2 pages

MySQL Exercise 4 Answer Key

This document contains the key and questions for an exercise on managing big data with MySQL. The questions focus on analyzing data from tables containing dog test and exam data. They include counting records by date, calculating averages, minimums, maximums and durations for test ratings and exam times. Questions also identify records with invalid negative exam durations.

Uploaded by

Nuts
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views2 pages

MySQL Exercise 4 Answer Key

This document contains the key and questions for an exercise on managing big data with MySQL. The questions focus on analyzing data from tables containing dog test and exam data. They include counting records by date, calculating averages, minimums, maximums and durations for test ratings and exam times. Questions also identify records with invalid negative exam durations.

Uploaded by

Nuts
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Managing&Big&Data&with&MySQL&&

Dr.Jana&Schaich&Borg,&Duke&University&
!
!
MySQL&Exercise&4:&Answer&Key
Question)1:
%%sql)
SELECT)COUNT(DISTINCT)Dog_Guid)
FROM)complete_tests
WHERE)created_at>'2014_03_01'O

Question)2:
%%sql)
SELECT)COUNT(*)
FROM)dogsO

Question)3:
%%sql)
SELECT)COUNT(exclude)
FROM)dogsO

Question)4:
%%sql)
SELECT)COUNT(DISTINCT)dog_guid)
FROM)dogs
WHERE)exclude=1O

Question)5:)
%%sql))
SELECT)test_name,)AVG(rating))AS)AVG_Rating,)MIN(rating))AS)MIN_Rating,))
))))))))))))))MAX(rating))AS)MAX_Rating)
FROM)reviews)
WHERE)test_name="Memory)versus)Pointing"O)
)
Question)6:
%%sql)
SELECT)TIMESTAMPDIFF(minute,start_time,end_time))AS)Duration
FROM)exam_answers
LIMIT)200O

Question)7:
%%sql)
SELECT)dog_guid,)start_time,)end_time,)TIMESTAMPDIFF(minute,start_time,end_time))
AS))))Duration
FROM)exam_answers
LIMIT)2000O

Question)8:
%%sql)
SELECT)AVG(TIMESTAMPDIFF(minute,start_time,end_time)))AS)AvgDuration
FROM)exam_answersO
Question)9:
%%sql)
SELECT)AVG(TIMESTAMPDIFF(minute,start_time,end_time)))AS)AvgDuration
FROM)exam_answers
WHERE)test_name="Treat)WarmaUp"O

)
Question)10:
%%sql)
SELECT)COUNT(DISTINCT)test_name)
FROM)exam_answersO

Question)11:
%%sql)
SELECT)MIN(TIMESTAMPDIFF(minute,start_time,end_time)))AS)MinDuration,)
))))))))))))MAX(TIMESTAMPDIFF(minute,start_time,end_time)))AS)MaxDuration
FROM)exam_answersO

Question)12:
%%sql)
SELECT)COUNT(TIMESTAMPDIFF(minute,start_time,end_time)))AS)Duration
FROM)exam_answers
WHERE)TIMESTAMPDIFF(minute,start_time,end_time)<0O

Question)13:
%%sql)
SELECT)*
FROM)exam_answers
WHERE)TIMESTAMPDIFF(minute,start_time,end_time)<0O

Question)14:
%%sql)
SELECT)AVG(TIMESTAMPDIFF(minute,start_time,end_time)))AS)AvgDuration
FROM)exam_answers
WHERE)TIMESTAMPDIFF(minute,start_time,end_time)>0O
&

You might also like