As I have mentioned, I am a database guy at work and a few years ago I wrote this quiz for a departmental holiday party. I would say ‘Send this to the Database Programmer in your life!’ but I don’t want to limit it to them. At the party, my wife, who has no programming experience, did very well – like she tied for first for the most correct answers or something. So . . . send this to the Christmas-loving person in your life!

A Very SQL Christmas Quiz

Name the Christmas Carol being referred to by the SQL select statement. Hint: Some of them are very easy.

Sample: Select instrmnt_type from vbnd03.Chime_makr_tab
Where Per_chrt_elmnts_symbol = ‘AG’

Answer: Silver Bells

1. Select Day_Key, Date_Date from Dgdw_Days_dim
where Mnth_nbr = 12 and Day_nbr = 25 and pers_mood_colr = #00FF00

2. Select Maml_Sub_type from VCrtr01.Anml_namd_rudlf
where Nasl_colr = #FF0000

3. Select Day_Key, Date_Date from Dgdw_Days_dim
where holly_ind = 1 and Mnth_nbr = 12 and Day_nbr = 25
group by 1,2 having sum(Jolly_fctr) > 150

4. Select natn_country_key, count(*) as person_count from Vgosa_prson
where roylty_ind = true and pers_gender = ‘male’
Group by natn_country_key
Having person_count = 3
 
5. Select Day_Key, Date_Date from Dgdw_Days_dim
where Mnth_nbr = 12 and Day_nbr = 25 and grnd_colr = #000000

6. Select Cretr_key from VCrtr01.Fictnl_Pers_namd_Frsty
where eye_mtrl = ‘Coal’ and nose_srce = ‘button’

7. Select Day_Key, Date_Date from Dgdw_Days_dim
where Julian_calndar_date between 360 and 365 or
Julian_calndar_date between 1 and 6

8. Select Hour_nbr, Day_date from Vgdw_Time_per
where hour_nbr in (20,21,22,23,24,0,1,2,3,4) and nois_fctr = 0

9. Select Day_Key, Date_Date from Dgdw_Days_dim
where merry_ind = 1 and day_size < 0.5 and Mnth_nbr = 12 and Day_nbr = 25

10. Select Day_Key, Date_Date from Dgdw_Days_dim
where Mnth_nbr = 12 and Day_nbr = 24 and hour_nbr in (18,19,20,21,22,23,24)

11. Select Day_Key, Date_Date from Dgdw_Days_dim
where Mnth_nbr = 12 and Day_nbr = 25 and year_nbr = 0

12. Select Persn_key from VPers01.Fictnl_Pers_unnamd
Where age <11, gender = ‘male’, hght_in_feet < 4 and instrmnt_type = ‘percussion’
 

Advertisements