Chris So
Oct 27, 2020

This is bad practice-SQL anyways, coz in production it is less readable.
To make it way more readable, one could consider formatting the code like this:

SELECT
column1
, column2
, column3
FROM mytable

That way each selected field is visually separated and errors like the missing comma can be avoided or quickly fixed.

However, I like that you showed how to handle NULL values b/c this is essential when working with data.

But I am missing how to actually handle duplicate keys like you showed in 4.
I mean, it's good to know that there are duplicates since there is no primary key in the table "City enhanced". But what to do about it? (Spoiler: ROW_NUMBER ;) )

Chris So
Chris So

Written by Chris So

Data Dude and SQL enthusiast. Occasionally does Pixel art◾

Responses (1)