7 kyu

SQL with Harry Potter: Sorting Hat Comparators

9,546sHale

Description:

There is truly no magic in the world; the Hogwarts Sorting Hat is SQL-based, its decision-making powers are common operators and prospectIve students are merely data - names, and two columns of qualities.

students

  • id
  • name
  • quality1
  • quality2

Slytherin are being quite strict this year and will only take students who are evil AND cunning.
Gryffindor will take students who are brave but only if their second quality is NOT evil.
Ravenclaw accepts students who are studious OR intelligent.
Hufflepuff will simply take those who have the quality hufflepuff.

(don't worry, for simplicity's sake 'brave' and 'studious' will only appear in quality1, and 'cunning' and 'intelligent' will only appear in quality2.)

Return the id, name, quality1 and quality2 of all the students who'll be accepted, ordered by ascending id.

Fundamentals
SQL
Databases
Data Science

Stats:

CreatedMar 29, 2018
PublishedMar 29, 2018
Warriors Trained13694
Total Skips947
Total Code Submissions39575
Total Times Completed9546
SQL Completions9546
Total Stars106
% of votes with a positive feedback rating89% of 975
Total "Very Satisfied" Votes790
Total "Somewhat Satisfied" Votes158
Total "Not Satisfied" Votes27
Total Rank Assessments8
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • sHale Avatar
  • Voile Avatar
Ad