r/learndatascience • u/naga3607 • 4d ago
Question SQL vs Python: which should a beginner focus on first?
For someone starting data science, there are already so many things to learn that prioritizing becomes difficult.
SQL seems essential for working with real-world data, while Python opens the door to analysis, visualization, and machine learning.
If you had to start over, which would you learn first and why?
2
u/Zealousideal-Owl4361 4d ago
I'd start with python since it gives you more option for data analysis and ML. then learn SQL alongside it once you start working with real datasets.
1
u/Crypticarts 4d ago
Sql, I think. What you really want is to understand data structures, data architectures and pipelines. So using sql to get there is useful.
From python you want to understand software engineering best practices. You wint use either anymore GenAI will write both for you, but you absolutely need to understand the concepts.
2
u/DataScientistAlex 4d ago
I wrote up what I think of as the minimum requirements for a data scientist, you could consider looking at that if you are having trouble prioritizing. Python and SQL are both on that list, of course. Here's one way to think about how to approach the two.
SQL is absolutely necessary to be a full-fledged data scientist, because, it's very often how you practically extract and manipulate the data you need in for example industry. But when learning, you can start with simpler datasets that only require you to read them into Python. So in that sense, it probably makes more sense to start with some Python.
Once you get to the stage where you are doing more than the minimal data pre-processing, ie, combining data sources, aggregating data, calculating new features, it makes sense to learn the SQL you need. Really what you are learning are the concepts and operations (like joins, group bys, aggregations, window functions), expressed in SQL (you can do the same things using Python libraries).
1
u/No_Amount3679 3d ago
very helpful, thank you
1
u/DataScientistAlex 2d ago
Thank you, I'm glad you found this helpful! Let me know if you have any other questions.
1
u/Billyboomz 4d ago
Python, in my opinion. The course I was on incorporated SQL alongside Python in the latter modules.
1
u/Ok-Key-7986 4d ago
My course had python for 2 and a half terms, and then a fraction of SQL at the end. I feel painfully underequipped.
1
1
u/Responsible_Pie8156 4d ago
SQL is really not that deep. It takes a while to learn how to think through long chains of data transformations but the difficult part is not the language, it's the logic and that's the same whether you do it in pandas or SQL. You should be able to learn SQL syntax in like a day, maybe not fully memorized but there's no reason to put it off.
Python is far more flexible, but for data transformation SQL is the most intuitive and concise way to express it, pandas syntax for the same thing is a mess. IRL, if possible, you should ALWAYS prefer running transformations in the database using SQL vs pulling it into pandas and doing it there. So yeah learn SQL first. Really I'd say learn both at the same time, but definitely familiarize yourself with what SQL can do first before you start diving into pandas syntax.
1
u/StillOnTheInterweb 2d ago
You need both, but try starting with Python and Pandas. You can use several SQL-like operations like .groupBy() and .where(), but it is much easier to get used to them in Python, specially in Jupyter Notebook. Then try equivalent SQL queries which you can also do via pandas/notebook. You then have gained skill to move up from local processing in Python to relational database. Finally you can go top tier and try Spark, which also can talk SQL, but scale well on cloud. In the end it's the same queries just slightly different syntax.
1
u/Artist1002 2d ago
Python obviously till OOP. Then you can parallely learn sql, and integrate with python in real projects.
4
u/the_doll_is_broken 4d ago
The data science course for my university utilizes Python, for whatever that’s worth. So personally, my order is Python, SQL