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

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?

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)