News for hackers. Stuff that matters.
Re:Ask HN: What things have richly rewarded the time investe... by geokon on Saturday September 29, 2018 @12:20PM (#18101168)
What's a good place to start learning SQL? (for someone with 5+ years C++ and now dabbling in Clojure/ELisp)
Re:Ask HN: What things have richly rewarded the time investe... by dan-robertson on Saturday September 29, 2018 @12:59PM (#18101427)
0. Look at a few simple sql queries (at most one join) and the corresponding schema. Internalise what the queries do and a rough idea as to the syntax

1. Have a database to query (or think of some project that is basically a frontend on a database and which you can give a reasonable amount of data)

2. Come up with questions for the database you want to answer

3. Look at the SQLite documentation. They have fantastic diagrams for the syntax of a sql query.

4. Write down the sql for your query (or work out what you can’t express and see if you can search on the internet to find out how to express it)

5. Look into relational algebra and try to work out how it corresponds to sql databases.

6. Repeat steps 2-4

7. Understand what different types of joins there are

8. Repeat steps 2-4

9. Read about more exotic things like nested queries, window functions, recursive queries, and so on (just look at the features of your database of choice and see what you can learn about). These might come in handy for future questions

10. Repeat steps 2-4 (repeatedly)

If you don’t know which database to use then start with SQLite. It’s basically fine for anything simple and manything complicated.

Re:Ask HN: What things have richly rewarded the time investe... by AlisdairO on Saturday September 29, 2018 @05:35PM (#18102980)
(self plug) you might want to give pgexercises.com a go. It takes you from beginner up to somewhat advanced with exercises that you can run in the browser.
Re:Ask HN: What things have richly rewarded the time investe... by victorpascu on Saturday September 29, 2018 @01:03PM (#18101445)
Personally, I like the gentle introduction given on W3Schools. It shows you what you have and what you aim to get out of it in terms of data, and removes the need to bother with a local setup, letting you focus on the actual queries instead.

https://www.w3schools.com/sql/

Re:Ask HN: What things have richly rewarded the time investe... by forinti on Saturday September 29, 2018 @01:09PM (#18101493)
Joe Celko's books are excellent. And then learn window functions.
Re:Ask HN: What things have richly rewarded the time investe... by Serow225 on Sunday September 30, 2018 @06:34AM (#18105571)
Re:Ask HN: What things have richly rewarded the time investe... by car on Saturday September 29, 2018 @08:33PM (#18103839)
Re:Ask HN: What things have richly rewarded the time investe... by Serow225 on Sunday September 30, 2018 @06:35AM (#18105574)
Re:Ask HN: What things have richly rewarded the time investe... by rane on Sunday September 30, 2018 @01:27AM (#18104606)
This might be useful: https://selectstarsql.com/