Hacker News new | comments | show | ask | jobs | submit login
Show HN: SQL Trainer – Learn SQL by doing live data exercises (bytescout.com)
303 points by eumm 19 days ago | hide | past | web | favorite | 49 comments

Some other similar tools I added to my notes from a similar thread: https://news.ycombinator.com/item?id=17905666

Interactive PostgreSQL SQL Tutorial - https://chartio.com/learn/sql/

Select STAR SQL - https://selectstarsql.com/

SQL Bolt - https://sqlbolt.com/ - Learn SQL with simple, interactive exercises

SQL Window functions - https://www.windowfunctions.com/

PostgreSQL Exercises - https://pgexercises.com/

SQL Zoo - http://sqlzoo.net/

SQL Teaching - https://www.sqlteaching.com/

Schemaverse - https://schemaverse.com/ - The Schemaverse is a space-based strategy game implemented entirely within a PostgreSQL database.

I saw that before. It's pretty crazy.

Hi, My name is Eugene and we made this little online SQL language trainer to help non-programmers to learn basic SQL queries. And more important, it shows the result of query entered.

Any suggestions and comments are welcome!

and many thanks for all the suggestion already made! And seems like we should better remove MySQL specific command from the very first question.

Maybe not remove it but perhaps have a choice of SQL 'flavor'.

That would be very useful, aka user chooses Oracle, MySQL, MS-SQL, etc.

Hey Eugene! In the last question, it seems you can get the same result by doing top 3, or limit 3, but only limit 3 is accepted as valid. You might either want to, if there's a valid reason for the distinction (execution order?), want to highlight as the difference between top and limit, or if there isn't, accept both.

thanks for the suggestion! yes, definitely will need to update the way it checks for correct answer as there can be multiple variations.

Nice! Would love to see this, but for complex queries.

Make sure it's virtualized/sandboxed, SQL basically guarantees HDD write access.

It would be nice if I could hit continue from the keyboard so that I could do the whole tutorial without using the mouse.

You can tab to the continue button

tab tab enter will do it, but yes, they might want to add a handler for enter in the text input.

Something that all of these tools (?) are missing are tutorials around concurrency, allowing multiple sessions to be in progress, interfering with each others operation. TBH this is an under-taught area of databases in general.

I have vague ideas about building a browser-based tool that allowed the user to queue up operations to be performed in order in multiple concurrent database sessions, allowing exact locking & blocking behaviour to be experimented with, but have never had time to work on this.

This is another one I found a couple of weeks ago: https://selectstarsql.com/

This is nice, but it's unfortunate that it starts off with commands specific to MySQL.

Is there an alternative (like a command to list all tables and which works on all DBMS)?

I mean using a specific sqlite/oracle/tsql/... command wouldn't be any better.

No, there isn't. But I don't see the need to start with these commands anyway. Or if the OP really feels like that's a necessary starting point, it would be great to have an option in the future to select what DBMS you're using. I wasn't intending to bash the work, but sticking to a single DBMS really limits the utility of what seems like it could be very general resource.

I like the idea of being able to select which dialect one wants to learn and maybe a table listing the most prominent differences (like LIMIT vs. TOP) at the end, would be nice too.

In theory `information_schema` is supposed to be universal, so you could do `select table_name from information_schema.tables`. However, getting useful information out of `information_schema` tends to require fairly complex queries and still has quirks and differences between databases.

i.e. "You may limit number of records using LIMIT keyword"

Postgres seems to use that as well.

Limit is the standard isn't it? Only Sybase/MSSQL Server use top x afaicr.

Pretty nice! It would be cool if this also had some basic joins added as well.

No joins? Its a bit trivial then. Otoh, explaining joins is pretty complicated compared to the basics.

This 'Late Payment Email generator' by same person is pretty good : ) I hate figuring out how to write those


Agreed, just add a few more steps to do joins as that's probably one of the most common requests that people need to do. Even providing a few basic inner or left joins could be enough.

joins will be added soon!

Here is another: https://sqlbolt.com

This is great, lots of my classes are using textbooks similar to this. On (13) "Please type SQL query to get 3 largest orders from orders table", it doesn't really tell you what column to order the results by.

I learned everything from: sqlteaching.com

It was created in a hackathon and uses sql.js, you can also create your own exercises through sql.js if you know a thing or two about web development ;)

SQL Teaching itself is also open source! https://github.com/rhc2104/sqlteaching

(Creator of SQL Teaching)

I like this, but as mentioned, it's a shame that it starts of with a MySQL specific command, SHOW tables

thanks for the feedback! Will change it

Maybe just an INFO block stating when a command is specific to a subset of DB engines and/or limited in applicability

thanks! added info that it is available in MySQL only. MySQL is pretty popular so this query can be good to know anyway.

Nice! I like the tutorial format. I made this along similar lines: http://konsumer.js.org/learnsql/

This is great. I'm mostly a front end dev and my SQL is rather poor...

This is common in front end devs. The higher you go in the stack the less you worry about these operations.

thanks! hope it will help to train sql skills in this simulator

Looks cool. But in my experience, theoretical understanding and some simple proofs are quite important in mastering SQL. I would suggest the intro to DB online course offered by Stanford.

thanks for the suggestion! I found the the theory can work great after some doing. Stanford course looks great for this purpose!

> In some popular databases like MySQL and others you may get the list of available tables just by typing: SHOW TABLES;

Is there any database other than MySQL that does that?

I like this one very much: http://sql-ex.ru/ Major part of questions is based on MS SQL Server though.

Would be cool if you didn't have to use your mouse so much. Kept having to click the next box to select it.

For Oracle, there is https://livesql.oracle.com

Just to toot my own horn - I wrote a book called SQL Practice Problems (available on Amazon), plus I also have an expanded problem set on my website SQLPracticeProblem.com.

The framework for the problems is that you get the problem statement, the expected results, and then you figure out how to write the SQL to get the results. I have lots of hints if you get stuck, but there's also a hint-free version, which some people prefer.

It really helps for people who like a "learn-by-doing" approach.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact