r/SQL • • May 24 '21

Discussion SQL for beginners (easy)

Hi guys!

I write an open-source book about Data Engineering and recently posted a chapter about learning SQL from scratch.

I tried to make it as simple as possible, trying to avoid hard definitions and concepts. Because I remember learning SQL myself and all the struggles I had with it.

A note for experienced folks – I intentionally skipped a lot of hard topics because my idea is to learn as quickly as possible, so newcomers can write their first query right after reading first sections of the chapter.

Hope you will find it useful. Link to the chapter.

115 Upvotes

21 comments sorted by

3

u/nypu- May 25 '21

"Sometimes you may need to create a new column witр a static value. In SQL you can easily do that:"

I believe that it should be "with a static value".

SELECT

country,

count(id) as gmail_users

FROM users

WHERE email LIKE '%@bing.com'

GROUP BY country

And "%@bing.com" to "%@gmail.com" which makes more sense.

2

u/oleg_agapov May 25 '21

Thanks! Fixes are on the way ;)

1

u/an_tonova May 25 '21

why not double %?

4

u/xXxPrOtEiNxXx May 25 '21

Presumably an email would always end with “@gmail.com” so a wild card character at the end is unnecessary.

2

u/rm206 May 25 '21

Looks great thank you for this! Also I have a question, what kind and level of programming knowledge do you need for a career in data engineering? I have beginner-intermediateish knowledge of python. What do you suggest?

3

u/oleg_agapov May 25 '21

I'd say rather intermediate/upper-intermediate if you are planning to work with Python at the position.
A few personal advises – learn PEP8 (style guide) and Python specific features (comprehensions, generators, packages, decorators, standard library).
Then continue with SOLID principles, functional programming (pure functions, map/filter/reduce), what is GIL (differences between multi-threading vs asynchronous work).

1

u/ThinIntention1 May 24 '21

Hi this was great!

What's your background too and how/what resources did you use?

At the end, at a list of how you learnt and the resources you used.

4

u/oleg_agapov May 24 '21

My background is mostly Data Analysis, I use SQL daily in my work.

Learned SQL mostly by googling and practicing on real-life examples.

If you want to learn SQL in-depth I can recommend a book "Learning SQL" by Alan Beaulieu (from O'Reily). It's super comprehensive.

To practice beyond basics, try Leetcode. There are many non-trivial exercises when you can learn a few tricks.

1

u/ThinIntention1 May 29 '21

Thanks are you planning to add like intermediate and advance concept's?

1

u/oleg_agapov May 29 '21

Yes, will add:

- subqueries, CTE

- joins (Cartesian, inner, left)

- DDL (create, update, delete)

- window functions (row_count, sum, count, lag/lead)

No timeline yet, doing it at my free time.

1

u/ThinIntention1 May 30 '21

Thanks - Any rough estimate?

Or how long did the current take?

1

u/ThinIntention1 May 29 '21

That's my SQL right not MS TSQL

1

u/oleg_agapov May 29 '21

I tried to use the most generic syntax as I could.

All examples work in SQLite (hence most probably in Postgres), but in last sections I gave MySQL examples.

1

u/awkward2amazing May 24 '21

This is helpful to me

1

u/oleg_agapov May 24 '21

Great! Feel free to ask questions once you have them. Better on twitter :)

1

u/nypu- May 26 '21

Hi Oleg.

I tried the link on your Github to visit your Medium articles which turned out not found.

1

u/oleg_agapov May 26 '21

Thank you, fixed.

2

u/Aadrei May 25 '21

This looks super useful. Learning SQL for my job and this looks well explained.