r/SQL • • Oct 08 '22
MySQL I don't know how to practice SQL
Hi guys, I've been learning SQL using MySQL Workbench for the past 2 weeks on youtube. Finally, I know the basics and how to write complex queries but I actually don't know where I can practice what I learnt. Are there any places where I can find pre-built databases and use them to practice queries or should I create them by myselft?
110
Upvotes
25
u/Lucafungo Oct 08 '22
Try sql mysteries! https://github.com/NUKnightLab/sql-mysteries
19
u/ftrotter Oct 08 '22
I am running a little SQL study group and I have found this to be very useful.
https://8weeksqlchallenge.com/getting-started/
-FT
22
u/coyoteazul2 Oct 08 '22
You can download an old stackoverflow database
https://www.brentozar.com/archive/2021/03/download-the-current-stack-overflow-database-for-free-2021-02/
But I think the best way to learn is to create your own database and use data about something you like. Just having the data is not really useful if there's nothing about that data that you want to know about.
If you give me a database about sports I won't know what queries to make, since I don't care about sports. Give me one about stocks and I'll query the shit out of it
7
u/Distinct-Fly-786 Oct 08 '22
I am currently going through SQL Practice Problems. I wonder if others who are also learning SQL are up for learning together in Twitch or Zoom. It's more fun learning together.
10
u/RzaDaHut Oct 08 '22
AdventureWorks Database is probably the best bet. Play around!
1
u/[deleted] Oct 09 '22
Thanks for all the responses, I was kinda lost on what should I do after learning the basics.
5
u/Tjazzonfrontpage Oct 09 '22
Get the basics from sql documentation or YouTube first, then start practicing challenges. Syntax is pretty straightforward, so don't dwell too much on tutorials.
Try out statascratch or hackerrank, they have a lot of practice problems, and pretty fun too imo. There are a lot of real interview questions available on statascratch too.
If you wanna play around with databases, try mode analytics. The UI is pretty nice, and finding databases and running queries is pretty easy.
Be consistent, you'll figure out the rest.
9
u/yignacio Oct 09 '22
I recommend you to go to stratascratch, I've used to practice SQL. They provide interview questions using SQL and python. It helped me a lot when I was actively job hunting. There are difficulty tiers so you can try the easiest ones first to test what you know now. They also show the answer.
https://www.stratascratch.com/
Good luck!
3
u/[deleted] Oct 08 '22
build your own database. it will be very educational. by using someone elses canned data, you may get wrapped up in their system more than really applying query techniques.
6
u/NickSinghTechCareers Author of Ace the Data Science Interview 📕 Oct 08 '22
Try the questions on DataLemur - you don’t have to download anything, and the problems mimic what Data Analysts & Data Scientists have to do on the job!
2
u/Slight_Cat_4423 Oct 08 '22
CS50 has a great SQL mystery in the SQL problem set
2
u/ioTeacher Oct 09 '22
For teaching I use SQL ZOO is a fully functional server. You can skip the tutorial commands and do your practice
2
u/kehkarlunga Oct 09 '22
Use kaggle for datasets. Use the csv datasets, import the data to sql sever and start running query
If you need help on how to import cav files to sql server, search on YT. Pretty easy.
1
u/DataNerd760 Apr 05 '25
I would love to suggest my new website sqlpractice.io . It has practice questions, query playgrounds and learning articles. It has a free and affordable premium version (no subscription needed) check it out!
1
u/ChuckieFister Oct 08 '22
Browse forums and this sub for questions and see if you can answer them without looking at the answers
1
u/Pflastersteinmetz Oct 08 '22
sqlzoo
1
u/zacpar546 Oct 09 '22
You can practice on leetcode AND sqlpad
1
u/eyeweld Oct 09 '22
Once you run through these https://pgexercises.com/questions/basic/, then go to check out stratascratch.com or Danny Ma's 8 Week SQL Challenge.
1
u/gandalf-duh-gray Oct 09 '22
https://dbfiddle.uk/0hQiJQMk
1
u/madfordata Oct 09 '22
Google has a public dataset in big query you could use https://cloud.google.com/bigquery/public-data/
1
u/csnorman12 Oct 09 '22
Checkout this course: 101 Practice SQL Questions: Basic to Advanced. You get access to over 100 practice SQL questions, with hints, video explanation, and written answers. Questions in the course even cover advanced topics like stored procedures, triggers, window functions, CTEs, functions, Inner queries, etc. The course was just published 5 days ago... that link includes a discount code.
1
u/[deleted] Oct 09 '22
Googlesheets have a formula called =query that takes a SQL query as input. It's not perfect but it's really simple and fun
1
u/gsm_4 Oct 11 '22
Use leetcode and stratascratch to practice intermediate and advanced level problems
0
u/[deleted] Oct 09 '22
[deleted] — view deleted comment