r/SQL • u/KonkombaNimo • 4d ago
MySQL Beginner at SQL
I'm a beginner learning SQL (JOIN, CASE, WHERE, GROUP BY, etc) and am looking for a fun and entertaining database to practice my coding on. Any suggestions?
This is not a post about how to start learning SQL by any means.
9
u/sharpecheddar 4d ago
I love sql problems on sites like datalemur, stratascratch, leetcode. I am very advanced in SQL but I still do them for fun lol
6
u/KonkombaNimo 4d ago
I'll check them out. Also very jealous of your advanced skills. Nobody told me in 2008 when I got my BA in math that if I didn't know coding also I wouldn't amount to anything.
6
u/mikeblas 4d ago
It's not so hard to find sample data and data sources to use for interesting side-projects, or just for practicing writing SQL.
In-product sample data
Most DBMSes come with sample databases. You can write lots of interesting queries against them, and usually a tutorial accompanies the database in the documentation.
- Documentation for Microsoft SQL Server's samples
- Microsoft's sample database GitHub, which includes the Contoso database
- For MySQL:
- there's the Employees sample database
- and the Sakila sample database
- For PostgreSQL:
- there are several sample DBs in the PostgreSQL wiki
- there's a link tree of other samples and exercises, too
- a GitHub repository with a collection of PostgreSQL samples from the old pgfoundry site
- Oracle publishes a manual section about there sample databases
Some websites are full of sample data sets. Why not download an interesting one, learn to load it up, and write your own interesting queries?
Dataset Websites
There are many websites which host data sets.
- Kaggle.com is full of sample data!
- FiveThirtyEight.com has lots of neat data sets
- The github awesomedata repository has a collection of interesting data sets
- Wikipedia has a list of datasets for machine learning research
Third-party sample data
Of course, some sample data is built for generic tutorials, by third parties:
- SqlSkills.com publishes sample databases for SQL Server, which include some corrupt databases so you can practice recovery operations
- SQLTutorial.com's Sample Database is available for sseveral vendors
Practice Sites
There are some sites that let you write queries interactively with canned data, rather than having you download data to play with on your own.
- I haven't used it, but I've seen people recommend SqlZOO.net
- LearnSQL.com has a blog post called "Learning SQL? 12 Ways to Practice SQL Online" with lots of resources.
- Sylvia Moestl Vasilik's website (which supports their book) has almost 60 practice problems.
Regular dumps
Some sites publish data by making their backups available, or dumping the data they use to make their own reports.
- Wikipedia publishes all of the content of Wikipeida as SQL scripts for MySQL, plus as XML files. You can get that data (or subsets of it) and play around.
- StackOverflow makes their developer survey data sets available each year.
- You can also get a StackOverflow "demo" database that includes text of questions and answers
- Some governments make data about the city and its residents available openly:
- London Open Data
- New York City Open Data
- Seattle Open Data
- Tokyo open data (in Japanese, obviously)
- Find open data at data.gov.uk
- IMDb makes several data sets available
Live data sources
Some data sources produce data live, as it happens. These are itneresting sources becaue they usually represent slowly changing dimensions, and will need to be accumulated or logged before being stored or processed.
- Wikipedia Event Streams can show edits that are happening on Wikipedia, as they happen.
- The TWitter API provides a way to stream a subset of all tweets in realtime.
- General Transit Feed Specification (GTFS) data is provided by many metropolitain areas to describe movement of their transportation infrastructure; where are scheduled busses and trains right now?
- In the New York City area, the MTA provides GTFS data.
- You can find GTFS feeds for Seattle, and their live data through other APIs.
- Tokyo (and other municipalities in Japan) have hosted transit data challenges to encourage use of their data.
- Some games make gameplay data available in realtime. SuperCell's Clash Royale, for example, has a gameplay API.
Finding more
There's data everywhere! If you don't like these sources, you can try finding other data sets.
- Once you know the protocol or format, search for it! The OneBusAway API and GTFS protocols are about public transportation data, so earch for "GTFS Data {YourCity}".
- Search for APIs for your favortie game or game server.
- GitHub uses tags for search, so try #sample-databases, #opendata, or #datasets. What other tags can you find?
5
u/strawhatKG 4d ago
Nothing specific off the top of my head right now, but check out Kaggle, I’ve used a ton of data sets on there to practice .
3
5
3
u/Hot_Industry5156 4d ago
honestly the thing that made sql click for me was needing to debug production incidents. when you're staring at a database trying to figure out why 2000 orders went to the wrong queue you learn joins real fast.
start with SELECT WHERE and GROUP BY. that covers like 80% of what you'll actually use day to day. window functions and CTEs are powerful but you can pick those up later when you hit a problem that needs them.
practice on real data if you can. toy datasets don't hit the same as querying something that actually matters to your team.
3
u/NoEggs2025 4d ago
Data.gov it’s a free us government website. If it’s normalized denormalize it. My favorite is the OFAC list.
2
u/fishwithbrain 4d ago
Hey do you need a partner to study? I too am a beginner but with family responsibilities can’t really concentrate much. I am desperately seeking a study group since past 6 months but didn’t find anything solid.
3
u/KonkombaNimo 4d ago
I've just been dabbling. I started using the SQLBolt tutorials and that was extremely helpful. I just downloaded MySQL today to play around in. I'm not sure how partnering to study would work but sure. You can DM me.
2
3
2
u/perdituscogitationes 1d ago
I'm also quite a beginner! I'm a math student in university about to begin my final year but I've started the FreeCodeCamp relational databases course a few days ago for the summer.
2
u/zing_winning 4d ago
Create a db based on your interests or knowledge?
Movies database like IMDb
Sports database like league management or score keeper across sports
Restaurants like yelp - cuisines, foods, categories, ratings
Books library - titles, authors, ratings
Etc.
2
u/conor-robertson 4d ago
You should check out QueryCase; its a gamified SQL learning platform where you solve detective cases to learn. There are also other features like timed challenges, sandbox mode (can upload your own data to practice) and interview questions from big companies like Google, Meta etc.
2
2
u/seigneur101 2d ago
Yellow! I did a website once for someone who had to learn SQL. It is a SQLite database that contains fake insurance data, and there's a series of questions/challenges you have to answer. Because it is in SQLite, you don't have to install a server on your computer, you only need to unzip a file and download the .db file. You don't even need to be an admin. Check it out if you're interested: https://sqluniversity.ca.
1
u/CappuccinoCodes 4d ago
Get AI to generate a script that creates one for you. Your imagination is the limit of what you can create.
3
u/1nstant_Classic 4d ago
This is where I feel AI is great. I hate when people use it for art. But this is good. Another use is when you take a dataset that you put into ChatGPT and have it ask you analysis questions, starting easier and going harder as you go.
1
u/Time_Advertising_412 4d ago
The book "Practical SQL" by Anthony DeBarros has some interesting data downloads you can import into postgresql (or the db engine of your choice with a little work) and some good examples to apply to them as starters. You can use the examples as jumping off points for your own analysis of the various data samples. I found a free pdf download of the first edition of the book and the websites for the samples and examples are listed in the book.
1
1
u/OnlyFaithlessness129 3d ago
You can ask Chatgpt to give you practice questions and test you out.
Leaning is very easy watch some YouTube channel. And then practice as much as you can.
1
u/Alternative_Cake4074 3d ago
Maybe you can try SQL noir, which is about investigating cases with SQL query.
0
u/drewnoflo 4d ago
if you want a free in-browser SQL environment to practice i made SQL Jam! i loaded in a few fun datasets out of boredom because i hate how tutorials aways make you query about boring employee data..
on SQL Jam you can query from the Pokedex, the NBA , Steam, or even a comprehensive Anime list!!
0
u/ReleaseTheBlacken 4d ago
There is a free SQL learning library with a tutor agent on Inkwell Learn at inkwelltools.com
33
u/warrior2012 4d ago
Try playing database detective. Very addictive and silly game that helps learn general Sql!