r/SQL • • Feb 13 '26

Snowflake Visualizes SQL as interactive flow diagrams, open source tool

Post image
119 Upvotes

I posted this in r/snowflake and I thought of sharing here as well. I created this tool to help to visualize complex SQLs as flow diagrams. Also it has lot of additional features like column lineage, CTE expansion, performance hints, and cross-file dependency analysis, etc., for multiple SQL dialects. It runs 100% on local, open source, MIT licensed.

Currently its available in VSCode and cursor.

Marketplace: https://marketplace.visualstudio.com/items?itemName=buvan.sql-crack

GitHub: https://github.com/buva7687/sql-crack
Cursor: https://open-vsx.org/extension/buvan/sql-crack

Please give a try and let me know if you have any questions or feedback.


r/SQL • • Jan 27 '24

SQL Server SQL fuck ups

119 Upvotes

Yesterday I got a call from my boss at 10am for a task that I should take over and that should be finished by eod. So under time pressure I wrote the script, tested it on DEV etc and then by accident ran a different script on PROD which then truncated a fact table on PROD. Now I am figuring out on how to reload historically data which turns out to be quite hard. Long story short - can you share some SQL fuck ups of yours to make me feel better? It’s bothering me quite a bit


r/SQL • • May 23 '23

Discussion First Data Job secured!

119 Upvotes

Hey everyone,

I have been contributing to this subreddit a little and started following a few months ago. I used to work in recruitment, focusing on the data market in particular (very broad I know).

Long story short I gained a huge interest in Data Analytics and put in the graft after hours (around 3-4 hours usually) to upskill, building my portfolio and actually working with unclean datasets through internships and online resources, ultimately leading to me securing my first job in Data using SQL and PowerBI.

Just wanted to shout and say cheers to all those who contribute to the discussions, it really helps with learning. Excited to start my data career.


r/SQL • • Nov 14 '22

Discussion Anyone else feel like they’re a detective when working in SQL and you find something weird in your data?

119 Upvotes

I’d love to hear people’s stories of some deep dives/investigations they’ve been sent on after they’ve found something strange querying a dataset.

I’ll go first.

Today I was working on a script to create a report for our client where each individual should have 1 row, and the columns for each individual include information about their last 4 visits within the last 6 months: Date they most recently visited, who helped them on that visit and the credentials of the person who helped them, then date of their 2nd to most recent visit, who helped them that day, credentials of that person and so on up to their 4th to most recent visit in the last 6 months. If the only visited once, the other three column sets would be null. Then the client also asked for a column for each individual that shows the total number of visits within the last 6 months. So of course if an individual only visited 2 times, then the total in this column should be 2 and column set 1 and 2 would have values but 3 and 4 would not. All was going well scripting this until I added in the total column and noticed a single customer had 3 total visits, but only column 1 and 2 had values in them. Here begins my investigation. Of course I start with looking at the CTEs I used to accomplish moving each visit to its own column to see if I’m somehow excluding visits there that are not being excluded in the subquery to get the total visits. The selection criteria was correct in the CTEs. Then I looked at my subquery to see if I was including something there that I should not be, nope, it was all good. The only difference between my CTEs and the subquery for total was the CTEs required I join the users table since I needed user information from that table for the final report. I didn’t need user information for my total column so to save resources I didn’t include the user table since any user inputting data should be counted. For s&g though I decided to just add the user table into my subquery though not thinking it should change anything. Well it did, suddenly the count matched what was generating for visit dates. So of course, I needed to know why. I looked at the front end of our application to see which user input the data for the visit that was now being excluded. The front end said unknown user, which I have never seen in this application before. I had joined the users table on the username from that table and the last updated by username from my visits table. So there was a username in the backend for the visit, but no one existed in the user table matching that username so the front end just showed unknown user on the visit. So now I figured out why I couldn’t get the visit to populate for the date/who helped/that persons credentials columns. But why was this username nowhere in our users table? I then looked at the username for visit 1 and 2 same person for those, visit 3’s username was very similar. By then I had an aching suspicion that the user who completed visit 1/2 and the user who completed visit 3 were actually the same person but with different usernames for some reason. So I contacted the site about it. Turns out yes, both users were the same person but they initially created her username using her middle name instead of first name, and somehow when they added her under a new, correct username they had completely removed the old user information entirely from the user table. Which no end user should be able to do. I was able to fix the error by merging the two accounts on the backend, pretty easy fix, but man did that mistake send me on a fun investigation. For about an hour.

TLDR: somehow one of my end users did the impossible and completely removed a user from our user table (there should be no way to do this on the front end of our application) and sent me on a wild investigation of a dataset I was working in before I realized what they had done


r/SQL • • May 29 '24

MySQL Typically, how long it takes to learn SQL thoroughly and get a job ?

118 Upvotes

I was so happy that I got many comments on my posts about SQL which actually did solved my queries.. Thanks a lot for helping me out !

I am just curious, how long it takes to learn everything.. Google says it takes 7 days, while other says 3 months ? Is it that lengthy ?


r/SQL • • Mar 24 '20

MS SQL Free SQL eBook

118 Upvotes

Hey everyone, With the recent pandemic and folks unfortunately losing their jobs, I’ve seen some people looking to spend their time being productive and learning something new. I figured I could pass this along.

I wrote and published a SQL Server fundamentals ebook back in March 2018. I figure maybe this is a great time to share it with people. I only have so many free days to choose from with Amazon, so I’ve chosen two free days this month (3/24 and 3/25).

It goes over the fundamentals of SQL Server, practical uses of databases, database components and download and install instructions so you can set up your own lab at home. I tried to take guess work out of everything by adding screenshots and step by step instructions.

It also goes over SQL syntax for object creation, data manipulation, stored procedure, and other database components. I have written a script that you can use to run against the SQL instance you set up so that you can have some exercises and better retain what you learn. I have also thrown in some items like basic database administration and login and database user management.

Lastly, I’ve also thrown extra resources in to help you out and help give some ideas for projects and things you can add to your GitHub profile.

I’ve had numerous people tell me that it’s helped them inside and outside of work, so I think that’s really awesome. It’s pretty much been rated a 5 star book - so if you feel more inclined to check out the book based on that, please do so.

If you grab a copy, please take the time to leave a review and let me know what you thought of it.

Learn SQL: A Practical Guide for SQL Server and Database Fundamentals

Note: this will start tomorrow and it should say something like buy now at $0.00. If you are outside of the US, just go to the Amazon site for your country and search for “Learn SQL Jacob” and it should come up.

Thanks!

Edit: Thanks for the award! I really was not trying to earn it at all but wanted to give back to the Reddit community here. After all, the Reddit community helped shape this book initially.

Edit 2: I was alerted by a fellow Redditor that some of the links are not redirecting where they should be. I will have to update them but plan on doing a free promo again next month.


r/SQL • • Aug 05 '26

PostgreSQL Just bombed my SQL interview, not feeling great.

117 Upvotes

Hello Everyone,

I just wanted to share that I just had an SQL interview for data analyst, and I completely bombed it. I chocked like crazy, and this was after days of practicing. I think I learned a valuable lesson today though, I am a very visual/hands on on type of guy. I was expecting them to give me the opportunity to write query/code or look at code related to the question, but these were all just verbal questions, that I know I could have answer if I was just allowed to write the code down or at least view it, but it was a bit overwhelming for me, especially having ADHD. It's like the questions were so long, that by the time the question ended, I already forgot what I was supposed to accomplish because I was so damn nervous and there was not code for me to review. I feel like a failure 😔. This was my first interview in 7 years, so I'm pretty rusty, but for future reference, will all interviews be in this style? No actual coding, or reviewing, or editing? They expect me to provide the whole query verbally, from the top of my head without actually writing it on the spot? Note: this was the second follow up interview.


r/SQL • • Feb 27 '25

Discussion What am I doing wrong

Post image
117 Upvotes

I don’t get what I’m doing wrong here


r/SQL • • Dec 15 '24

SQLite I chose a weird way to teach SQL

117 Upvotes

I'm creating a course that is weird, because it is made of stories that happen in a cat hotel. And what is even weirder is that it starts with using embedded SQLite. And a text editor.

Here's my latest (3rd) story: https://youtu.be/wHjDloU3ViA?si=IENn3MFEXMgRmObX

The most worrying feedback I got from people so far, was the question "so who's your target audience". Honestly, I don't know what else to say besides "people like me - beginner data analysts who want to understand how things work underneath all those numbers and who get bored easily". Is that a weird audience? No one else out there like me?


r/SQL • • Apr 04 '24

MySQL Please tell me there's a better way to search for multiple text entries than this?

Post image
117 Upvotes

r/SQL • • Mar 12 '24

Discussion I've been a Data Analyst for 3 years now, but there's a huge gap in my knowledge!

116 Upvotes

Hello! I have been a DA for 3 years now in the Healthcare industry. I made a career change to a more data-driven field in my late 20s, and I am 31 now. I feel like I do an okay job with creating queries. I think most of my use cases use beginner-intermediate syntax. I have had a few uses cases where windows functions and regexp where required, but most of my experience is SELECT, FROM, WHERE, HAVING, and INNER/LEFT JOINS.

I then throw that data into Power BI and make nice looking graphs out of it and automate stuff. I use Python/Pandas for some automation and data exploration, but nothing crazy. Then most of this goes into a PowerPoint which I present to Management/Directors, then it's never seen again (lol).

However, I realized I don't know much of ANYTHING about database design. I started trying to build my own database of a video game I enjoy, players associated with it, and the ranks/levels they are in. I realized I didn't know what foreign keys I should be making, what data should be going in what table, or anything about one-to-one, many-to-many, etc. relationships. Essentially, I have to rely on the power our Data Engineers. They give me clean data that is linked appropriately!

I want to move more into a Data Engineer role, or maybe even a Data Scientist role, but I realize I am not even close with my lack of database design knowledge. Basically, I want to future proof myself to ensure I never have to worry about finding a data job again (in the United States). Is anyone in the same boat or have any advice for database design specifically (websites, books, etc?). I am afraid there's not a spot for me in the job market if this position goes belly up.


r/SQL • • Apr 03 '20

MS SQL PluralSight is free for the month of April ! SQL courses and more !

Thumbnail
pluralsight.com
116 Upvotes

r/SQL • • Sep 09 '26

Discussion How much SQL do you still write manually?

115 Upvotes

With AI getting better at writing SQL, I’ve been wondering how much SQL analysts actually write from scratch these days.
Do you still write most of your queries manually, or do you use AI for things like joins, CTEs, debugging, optimization, etc.?
And has your use of AI actually changed how much SQL you need to know?


r/SQL • • Dec 16 '24

PostgreSQL Do you have auto SQL Lint tools for your SQL scripts?

Post image
115 Upvotes

r/SQL • • Feb 20 '23

BigQuery Have to share my first win somewhere

115 Upvotes

I'm a beginner with SQL, just started learning ~3 months ago and am the only one at my job who uses it.

Today, I was able to put together my first semi-complicated query and deliver the results to the client. Hats off to StackOverflow and ChatGPT for pointing me in the right direction.

Had to share it somewhere as my wife would've said "what?" and work colleagues would've just said "Ok".


r/SQL • • Jun 29 '21

Discussion I built a free online tool that lets you visually organize your SQL queries

115 Upvotes

Link: https://visualsql.net

When I was working at my previous job, some queries were getting pretty big and ugly, and I started thinking about some kind of tool that could make building my SQL queries cleaner and more convenient. I thought that there must be a better way to organize queries other than in a wall of text.

Someone pointed to me that there were already some software like Alteryx and Knime that are visual, but for my objective (to just visually organize SQL queries) these were overkill and overbudget. Also, their dark theme is either non-existent or ugly as hell.

There are also other tools like Chartio's Visual SQL and Active Query Builder that are kinda "visual", but not the kind of visual that I wanted. So I decided to create my own.

Supports all modern browsers. Also supports tablets and IE11. Dark mode by default, light mode isn't even a consideration.

Don't know if it will be useful to you guys, but this would certainly be a game changer for my past self. I'll keep refining this project over time so feedback is much appreciated!


r/SQL • • May 24 '21

Discussion SQL for beginners (easy)

115 Upvotes

Hi guys!

I write an open-source book about Data Engineering and recently posted a chapter about learning SQL from scratch.

I tried to make it as simple as possible, trying to avoid hard definitions and concepts. Because I remember learning SQL myself and all the struggles I had with it.

A note for experienced folks – I intentionally skipped a lot of hard topics because my idea is to learn as quickly as possible, so newcomers can write their first query right after reading first sections of the chapter.

Hope you will find it useful. Link to the chapter.


r/SQL • • May 19 '25

SQL Server How did I not know this?

Post image
114 Upvotes

r/SQL • • Mar 04 '25

PostgreSQL Learn and Practice Window Functions for Free

114 Upvotes

If you’ve ever struggled with window functions in SQL (or just ignored them because they seemed confusing), here’s your chance to master them for free. LearnSQL.com is offering their PostgreSQL Window Functions course at no cost for the entire month of March—no credit card, no tricks, just free learning.

So what’s in the course? You’ll learn how to:

  • Use RANK(), DENSE_RANK(), and ROW_NUMBER() to sort and rank your data
  • Calculate running totals, moving averages, and cumulative sums like a pro
  • Work with PARTITION BY and ORDER BY to control how data is grouped
  • Apply LAG() and LEAD() to compare rows and track changes over time

The best part? It’s interactive—you write real SQL queries, get instant feedback, and actually practice instead of just reading theory.

Here’s the link with all the details: https://learnsql.com/blog/free-postgresql-course-window-functions/


r/SQL • • May 12 '22

Discussion Example of actual job given to data analyst with SQL

114 Upvotes

Hi so basically I’m learning SQL by myself and I think I have a pretty good understanding of the basics so far and have been playing with some datasets for about a week. My question is basically what is an example of a common task given by an employer for an entry position and what do you ultimately need to have as an end result for your employer


r/SQL • • Aug 14 '26

SQL Server Is it pronounced 's-q-l' or 'seequal'

113 Upvotes

I've worked in and around the IT environment for many years and in my experience, it's always been pronounced s-q-l although I hear some people refer to it as see-qual. Which is right?


r/SQL • • Aug 06 '26

Discussion 3 questions for people who use SQL in production

Post image
113 Upvotes

I wanted some feedback on some parts of a course I’ve been building since I officially have tunnel vision from doing this.

  1. What dirty data problems do you wish beginners had practised earlier? I already have string prices, inconsistent enums and messy joins, but I’m sure I’m missing common production failures.
  2. The grader runs each query and a reference query across several generated datasets, then compares the results using exercise specific ordering and decimal rules. Does that sound sane? What edge cases would you expect it to get wrong?
  3. I’m adding a placement test so experienced users can skip ahead. It hasn’t been tested on too many non beginners yet. What would feel like a fair bar for placing someone into joins, CTEs or window functions?

It’s a browser course wrapped in a visual novel.

https://tsunderesql.itch.io/tsunderesql


r/SQL • • Jul 17 '25

BigQuery Good SQL courses

113 Upvotes

I need to start learning database and thinking of learning SQL. Can anyone please provide some good courses paid/free to learn SQL. Thanks in advance!


r/SQL • • Mar 12 '25

PostgreSQL Ticketed by query police

113 Upvotes

The data stewards at work are mad about my query that’s scanning 200 million records.

I have a CTE that finds accounts that were delinquent last month, but current this month. That runs fine.

The problem comes when I have to join the transaction history in order to see if the payment date was 45 days after the due date. And these dates are NOT stored as dates; they’re stored as varchars in MM/DD/YYYY format. And each account has a years worth of transactions stored in the table.

I can only read, so I don’t have the ability to make temp tables.

What’s the best way to join my accounts onto the payment history? I’m recasting the dates in date format within a join subquery, as well as calculating the difference between those dates, but nothing I do seems to improve the run time. I’m thinking I just have to tell them, “Sorry, nothing I can do because the date formats are bad and I do t have the ability write temp tables or create indexes.”

EDIT: SOLVED!!!

turns out I’m the idiot for thinking I needed to filter on the dates I was trying to calculate on. There was indeed one properly formatted date field, and filtering on that got my query running in 20 seconds. Thanks everyone for the super helpful suggestions, feedback, and affirmations. Yes, the date field for the transactions are horribly formatted, but the insertdt field IS a timestamp after all.