6 kyu

SQL Basics: Simple NULL handling

8,432 of 8,434matt c

Description:

For this challenge you need to create a SELECT statement, this statement must have NULL handling, using COALESCE and NULLIF.

If name is an empty string, you must replace with '[product name not found]'.

If card_name is an empty string, you must replace with '[card name not found]'.

If no price is specified (i.e. price is NULL), or if the price is 50 or less, you must discard the row.

eusales table schema

  • id
  • name
  • price
  • card_name
  • card_number
  • transaction_date

resultant table schema

  • id
  • name
  • price (greater than 50.00)
  • card_name
  • card_number
  • transaction_date

NOTE: Your solution should use pure SQL. Ruby is used within the test cases to do the actual testing.

SQL
Fundamentals

Stats:

CreatedOct 26, 2016
PublishedOct 26, 2016
Warriors Trained19134
Total Skips2955
Total Code Submissions48932
Total Times Completed8434
SQL Completions8432
Total Stars164
% of votes with a positive feedback rating85% of 1053
Total "Very Satisfied" Votes785
Total "Somewhat Satisfied" Votes227
Total "Not Satisfied" Votes41
Total Rank Assessments8
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • matt c Avatar
  • user5036852 Avatar
  • trashy_incel Avatar
Ad