Related Posts
Need 11 likes to unlock DM
Christmas Eve appetizer 2: caprese cups

Additional Posts in Technology/IT Consultants
New to Fishbowl?
Download the Fishbowl app to
unlock all discussions on Fishbowl.
unlock all discussions on Fishbowl.
Need 11 likes to unlock DM
Christmas Eve appetizer 2: caprese cups

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Download the Fishbowl app to unlock all discussions on Fishbowl.
Copy and paste embed code on your site

Scan your QR code to download
Fishbowl app on your mobile

Practice. Start small and then go increasingly complex over time as you get comfortable with each step below:
1. Start with Simple select *
2. Add filters and where clauses
3. Simple operations - SUM, MIN, MAX,
4. Aggregate functions - GROUP BY & HAVING
5. Learn JOINS - LEFT, RIGHT, INNER, FULL and practice joining two simple tables
6. Join multiple tables
7. Data transformation operations - CAST, Concatenate, Format etc.
8. Conditional - WHEN, EVALUATE
9. Subqueries
10. Advanced SQL - ROW NUMBER, Cumulative Sum, RANK etc.
11. Combine all of the above to create a 7 pager complex SQL :D
In my opinion you need to know three things;
1. The logic operator’s available to you in order to create a query
2. The data tables primary keys
3. The data set you are trying to find
Would say the order of operations of logic in a query is most important
Early on, I found it helpful to write out a couple complex queries (with proper formatting). I put each in the center of a page and wrote out notes of: what each clause was doing, why a join was written a certain way, how xyz avoided a duplication issue, etc
A simple thing (in my view).
Understanding the business context around the tables you're using is KEY to understanding your query. Simple example, when working with SAP tables, understanding what the PKs are, the date fields and the key attributes represent is easy (ex: EKKO stores my PO, Contract, etc headers, and I use BSTYP to tell which is which). Once you are familiar with the business context behind your tables and fields, writing SQL is like writing a sentence. (Same ex: SELECT * FROM EKKO WHERE BSTYP = 'F' ORDER BY AEDAT DESC).
Now this is applicable for any type of tables you're working with (obviously some are more complex, with less obvious context, etc.) But the principle remains the same.
PS: It just takes time, practice, trial and error to get comfortable with SQL. When I started I had the exact same experience!
Also EY2 gave a very good list of increasingly complex query parameters!
If you are more familiar with excel, find some uses cases where you used multiple excels/tabs to collate data to solve some problem. And use that to find/write equivalent SQL. That way you’ll learn faster.
1) Cheat
2) Steal
3) Study
First, if you understand the basic syntax, use a database tool with a GUI that joins tables and uses filters. Then look at the SQL it generates. Try modifying it little by little. That's how you learn by cheating.
Look at example code from other queries. Know what the objective of the code is. Learn it. Try to recreate the logic and modify it so it does something else useful. I've learned tons from reverse-engineering other people's SQL. That's how you learn by stealing.
As you're learning from cheating and stealing, just Google what you don't understand. Watch online videos. There's an entire "Learn SQL" section on W3C.
It will help greatly if you understand the underlying type and structure of the database/tables you're querying. It will guide you to the type of relationships you need to build and to how to optimize your query.
Above all, practice. A lot. There's no magic bullet.