Am I the only one who finds python easier/more intuitive than sql?

New / Data cahoots
Aug 31 31 Comments

I can't count the number of times I've thought "this would be so much easier in python!" as I write SQL queries.

Tc:78k (yes I know it's low)
Yoe: 4

comments

Want to comment? LOG IN or SIGN UP
TOP 31 Comments
  • Doesn’t everyone think that?
    Aug 31 5
    • New / Data cahoots
      OP
      Oh ha. For some reason I got the idea that SQL was looked down on as a "easy" with people calling analysts "SELECT * monkies"
      Aug 31
    • Lol, people who do that are idiots...SQL is a full programming language with recursion and all. If you want to ruin your life, that is.
      Aug 31
    • New kplay
      Anyone who thinks sql is easy hasn't really used complex sql.
      Aug 31
    • Amazon / Eng SmkWdEvyDy
      I've seen 500 line sql queries. And it was way harder to understand than a 500 line Python script.
      Aug 31
    • New kplay
      Agreed
      Sep 1
  • Microsoft LPiV33
    it is because you have all the data in memory using pandas dataframe. SQL is not just select statement, it is way more than that.
    Aug 31 0
  • Cisco cronaldoe
    Try selecting median values in sql lol have fun that’s one line in python
    Sep 1 2
  • Amazon pyguy4evar
    Different things - I don't understand the purpose of this post.
    Sep 1 1
  • Roku Roku.
    SQL can do a lot more with a small query than post processing data with python. Also less logic means less bugs. I'll always use queries when I can.
    Aug 31 1
    • New / Data cahoots
      OP
      Yeah that's a good point. I guess I just need to practice more. It's hard to find really in depth sql questions though!
      Aug 31
  • Amazon / Eng
    fahrenheit

    Amazon Eng

    PRE
    Zalando
    fahrenheitmore
    They really are for different purposes. Tons of things are really easy in SQL but difficult in Python, yet others are the other way around. It's true that Python's list/dict comprehensions sort of give you some SQL-like features so there's significant overlap, but Python can only really do that trick with data in memory, and there's still stuff that's not as convenient or easy as in SQL.

    Also, having worked extensively with both, I have to say it's VEEEEEERY common for SQL-focused jobs to be done by shitty developers who don't know the first thing about writing decent, maintainable code. To be fair, SQL's design actively disincentivizes modularity in various ways, and more so for shitty implementations or if you need to stick to features supported cross-engine. The result is that even though SQL is pretty powerful (especially in good engines), most SQL code out there is absolute garbage and a pain in the ass to work with.

    Python is more geared towards general developers who usually care more about writing decent code, and Python's design and culture are particularly (over-)prescriptive and force a lot of uniformity on how you structure your code. That makes it easier even if it's often limiting and inconvenient.

    I would encourage you to review some of the more advanced SQL features in a good featureful engine. PostgreSQL is about as good as it gets, and has many tricks up its sleeves: JSON manipulation, several special types of indexes and the ability to define them on subsets of your data or expressions computed from them, recursive CTEs, window functions, lateral joins, rollup/cube, granular control for concurrency, various modes for cross-transaction visibility control, sampling-based queries…
    Sep 1 0
  • Amazon pwqk54
    The first things u learn is always intuitive than the things that come later in life
    Aug 31 2
    • Apple mr.schrute
      Well this is shit whoever said it since I learnt SQL first and still find Python intuitive?
      Aug 31
    • Amazon pwqk54
      Ok. Let me rephrase it. Things that u spend most time on are more Intuitive than the things that u don’t
      Aug 31
  • Google uzaname
    For the things that were easy in SQL, are you thinking 'this would be so much harder in Python?'.
    Sep 1 0
  • Zulily / Eng
    Expeditor

    Zulily Eng

    BIO
    AI Enthusiastic SDE.
    Expeditormore
    Python is an awesome language. It is definelty easy to learn and more powerful than many oldschools' argue.. SQL is powerful but knowing just sql will not keep you on the run. I know many ppl who knows only SQL suffer in Job market. There is a prediction that states AI will code Python in few years, I bet AI can do SQL queries well ahead of this. All the best.
    Aug 31 0
  • Tesla lambdaq
    If you don’t know how to use sql, sure.
    Aug 31 0
  • Microsoft bhgcdtjllh
    OP, are you a data analyst in Bay Area?
    Aug 31 4
    • New / Data cahoots
      OP
      Sure am!
      Aug 31
    • Microsoft bhgcdtjllh
      TC seems low for Bay Area. Year of experience?
      Aug 31
    • New / Data cahoots
      OP
      I've got 4.
      It's definitely low. I am interviewing right now and trying to course correct
      Aug 31
    • Amazon cardz
      Let me know if you need a referral at Amazon!
      Sep 1
  • Bank of America / Product Quacky
    Python will always be easier for anything that require iteration, otherwise SQL is easier
    Sep 1 3
    • Amazon / Eng
      fahrenheit

      Amazon Eng

      PRE
      Zalando
      fahrenheitmore
      Look up lateral joins. They're basically iteration in SQL.
      Sep 1
    • Bank of America / Product Quacky
      I'm not saying it's impossible, I'm just saying it's easier
      Sep 1
    • Amazon / Eng
      fahrenheit

      Amazon Eng

      PRE
      Zalando
      fahrenheitmore
      It's exactly as easy if you use lateral joins. It's not some complicated workaround to restructure your query in a way that does the same thing as the iteration you wish you could do. It's simply straightforward iteration.
      Sep 1
  • Uber / Eng utf
    Rarely but it does happen
    Sep 1 0

Salary
Comparison

    Real time salary information from verified employees