Trying to get balls deep into SQL, dont really like it, any tips?
2 02 Feb 2017 23:54 by u/Dougal_McHaggis
I know SQL isn't programming, but trying to learn it more in depth coming from procedural programming, i'm finding it difficult. Lumping everything in to a big query it's hard to follow what's going on.
7 comments
3 u/Nietzsche__ 03 Feb 2017 01:31
You have to treat a query the way a programmer would treat a function. It can be boring, but gives you a great amount of power once you're really good at it.
Focus on the FROM clause first to choose which data you need and how it's related. Next, the WHERE to filter down to only what's needed. Finally, work on the SELECT to choose what you want after you have the correct result set.
That order is important once your queries or days sets become more complex.
Long live Oracle!
0 u/GoddammitMrNoodle 03 Feb 2017 03:36
Seriously, after working in a RDBM all day having to write an SQL query felt like being forced to write COBOL code.
2 u/Datawych 03 Feb 2017 01:26
How can you not like SQL?
You tell the database what you want, and then it gives it to you.
If you're having to do super complex, multi-nested queries, the person who designed the tables for that DB is a retard.
1 u/Antikaon 03 Feb 2017 09:31
You'll get the hang of it in time, trust me. I've worked with some complicated SQL in several environments. Mostly MySQL, and DB2/400 (that's the "embedded" database that is actually the file system on IBM's iSeries machines... It's pretty cool). I went from not knowing anything about SQL to being pretty damn good at it, being able to pull in data from dozens of tables across multiple data sources and systems. You start to think in SQL, and you'll get an intuitive sense of how to get at and organize the data you want.
And it only took me 16 years.
0 u/JohnQCitizen 03 Feb 2017 01:23
SQL is a bastard of a language. You pretty much got it.
0 u/captbrogers 03 Feb 2017 03:49
Are you using command-line or a desktop application?
0 u/alexkobold 04 Feb 2017 13:39
Learn the basics and then chill. Odds are that you'll tend to access databases through helper functions in a procedural language that construct SQL queries for you.