r/datascience • • Jul 20 '20

Fun/Trivia Distributed Computing and SQL

Post image
1.1k Upvotes

53 comments sorted by

View all comments

Show parent comments

30

u/sohaibhasan1 Jul 20 '20

Is you can comfortably handle joins, case whens, subqueries, unions, where's, havings, and window functions, you're solidly intermediate. I'd also maybe add extracting data from json columns.

0

u/[deleted] Jul 20 '20

[deleted]

4

u/reallyserious Jul 20 '20

Add in the WITH keyword as well if you're not already familiar with it.

4

u/nemean_lion Jul 20 '20

Ooh I don’t think I’ve used with before. What’s the use case? Join conditions?

4

u/Zeiramsy Jul 20 '20

It is basically building a sub-query. You can "save" a query as a temporary db and then query from that db in the same query.

3

u/reallyserious Jul 20 '20

Like the other poster hinted at, WITH helps you break up tricky queries in smaller named queries. So you don't need to have these monster large queries that takes a while to even begin to decipher.

It can absolutely help with joins. But don't limit yourself to that use case. It makes the SELECT statement more powerful and easy to read. Some DBMSs like MSSQL also support WITH in DELETE and UPDATE statements.

Once you've gotten used to using the WITH statement you'll never go back.

→ More replies (0)