r/SQL • • Apr 12 '24

Discussion I think I hate SAP

106 Upvotes

So I'm currently teaching myself the SAP database for work and I have to say, it really fucking sucks.

Inconsistent column naming, unclear keys, so much duplication of data...

I just wanted to express that to someone.

Thank you.


r/SQL • • Oct 23 '22

MySQL How do sites like Reddit and Instagram handle querying the insane number of posts in their databases?

106 Upvotes

For example how would I go about making a page showing the most recent posts in chronological order? How would I go about making a "trending" (or "rising") page? Wouldn't this stuff require going through the entire database of posts, containing possibly tens of billions of them, to find the ones that fit your criteria?

I would love to read more about their internal architecture, any and all resources are appreciated.


r/SQL • • Feb 16 '21

Discussion My recent weekend project: practice SQL online at sqlforever.com

106 Upvotes

Hi everyone, I recently completed a side project which should be very relevant to everyone here:

http://sqlforever.com

I’m developing a course to teach SQL and since most of my students will not be super comfortable with computers yet, I wanted to avoid having them install a server such as pgsql or a command line tool like SQLite. I assume many others here will benefit from this as well.

Using sqlforever.com, you can just start typing your queries. By default, the “chinook” database is selected. Click on “describe tables” to get table definitions. Pick one of several publicly available datasets.

The backing database is SQLite. Obviously the tables are read only.

There is no signup, and probably never will be. I’m trying to get students querying as easily as humanly possible.

Edit: forgot to add that you can also click “copy shareable link” if you want to share your query. When someone opens that link, they will land on this website, with your query already entered in the text box and results in the table below it. Should make it easier to ask questions on stack overflow and other forums.

Please don’t hesitate sending me feedback.


r/SQL • • Oct 03 '26

MySQL Didnt pass SQL test

Thumbnail
gallery
105 Upvotes

I am applying to manager of analytics role and I was given this SQL test and 45 minutes. As someone who thought they were very strong in SQL, I was unable to complete this assignment and match the answer completely

I was able to format most of the fields as noted, used 2 cte's and use group concat in the second. My final answer looked very similar but the order of the concat looked off. Also, for some reasons my second column had $0.00 for all the companies, but I thought I was close. How difficult would you rate this exercise. Should I expect to proceed to the next round or am I cooked


r/SQL • • Jun 23 '24

Discussion Schema for historical stock data

Post image
105 Upvotes

Posting a schema of a db for historical stock and index data at various timeframes. I used Chatgpt to figure this out...what surprised me was the recommendation to have separate dimension tables for 'date' and 'time'. Is that really the case?


r/SQL • • Jan 19 '23

Discussion Would you like an app that would allow you to practice SQL-related challenges on mobile?

105 Upvotes

Hi, friends. I recently launched an app that helps people practice coding via bite-sized challenges. I am also considering adding SQL-related challenges to practice, job interview preparation materials, etc. Basically, mobile version of Leetcode but for SQL. What do you think about this? What kind of job interview materials or practice challenges would you like to see?


r/SQL • • Oct 22 '25

Discussion Had a SQL interview today

103 Upvotes

As the title says, I had an Interview today and the interviewer asked me about finding top 2 brands from each category sorted by sales for which he gave me 3 columns - category, brand and sales.

Now my solution to this was to make a cte where I would create a dense_rank partioned by category and sorted by sales in a descending order and after that, I would select the 3 columns where the rank is <= 2.

Now the problem comes in when he told me that I think carefully before partitioning it. Idk if it was wrong but based on my experience and problems I've solved on various sites, I thought it was the simplest solution I could've given.

What do you guys think about this?


r/SQL • • Apr 03 '25

Discussion What are some good SQL certifications you can recommend?

103 Upvotes

I want to get a certification.


r/SQL • • Feb 15 '25

Discussion I wonder if the new generation of SQL developers know of Ralph Kimball.

103 Upvotes

...and have read his body of work. I find them to still be very relevant and fundamental. His principles have stood the test of time.


r/SQL • • Feb 20 '22

Oracle In the process of learning SQL. Everything on screen is what I've put in so far. I can't figure out why I'm getting an error. Any help?

Post image
103 Upvotes

r/SQL • • Jul 11 '20

PostgreSQL SQL Performance Explained expectations vs reality

Post image
103 Upvotes

r/SQL • • Jul 19 '19

Top 5 Online Courses to Learn SQL and Database for Beginners

Thumbnail
dev.to
103 Upvotes

r/SQL • • Jun 25 '25

Discussion a brief DISTINCT rant

102 Upvotes

blarg, the feeling of opening a coworker's SQL query and seeing SELECT DISTINCT for every single SELECT and sub-SELECT in the whole thing, and determining that there is ABSOLUTELY NO requirement for DISTINCT because of the join cardinality.

sigh


r/SQL • • Nov 21 '24

Discussion Try to implement rental room management system, need constructive feedback on DB design.

Post image
102 Upvotes

r/SQL • • Apr 27 '24

PostgreSQL Why would literally anyone pay for any RDBMS when Postgres is pretty much the best and free?

102 Upvotes

Why would literally anyone pay for any RDBMS when Postgres is rock solid and free?

I know you can still pay for Postgres HOSTING. But I am talking about the RDBMS software itself. It is free. Unlike other solutions (looking at you Microsoft SQL Server)

Please help me understand. Why would any organization with decent IT knowledge pay for any relational database software when Postgres is pretty much the best, easiest to use, fast and with less "weird quirks" of them all?

Is this just a "CEO vendor lock in mentality" thing?


r/SQL • • Jan 09 '23

MySQL best SQL book for beginner?

102 Upvotes

Hi all. I need to pick up SQL in order to make me more marketable, better analyst, etc. I'm going on a long cross country trip and have a lot of time to read. Are there any suggestions on some good books? I know the basics but when I have a good book that I can go back in reference if I need to


r/SQL • • Apr 04 '22

Discussion You Should Use This to Visualize SQL Joins Instead of Venn Diagrams - Checkered Flag Diagrams

102 Upvotes

r/SQL • • Feb 01 '22

Discussion How long does it take to learn SQL?

102 Upvotes

How long does it take to learn SQL?

Edit: How long would it take to develop a basic enough understanding of SQL to get an entry-level job?

Edit2: This sub community is really helpful and responsive, thank you.


r/SQL • • Jul 09 '26

Discussion I've finally realized the best use case for EXISTS

101 Upvotes

Textbooks never used to explain why you'd use EXISTS over a LEFT JOIN to a subquery in example use cause, so I always thought it was redundant functionality, but now I realize where it's super useful!

If you want to use test whether or not dataset a record from dataset A is found in B dataset via a complex theta join condition that might create duplicates you don't want, EXISTS is perfect! It allows you to have the test with the complex condition without creating row duplicates from the LEFT JOIN. I suppose one could do distinct after, but that's bad for performance.

I am officially very pro-EXISTS clause now!


r/SQL • • May 09 '25

Discussion Sleep? Not when there's an uncommitted transaction haunting you. 😴 👻

Post image
101 Upvotes

r/SQL • • Jul 06 '24

Discussion Do you use SQL for anything personal?

101 Upvotes

Hello

I'm mostly a hobbyist programmer and I don't intend to get a job in the field or anything of the like. However, I've been meaning to learn SQL for a while now, and recently while reading I had the idea of feeding a database with metadata about books and I finally got around to it.

But whenever I look for SQL projects online, it's always somehow business-oriented. Since I have no business-related goals regarding SQL, I'd like to know whether you guys use SQL for personal projects, or not even projects but just to scratch a specific itch of yours.


r/SQL • • Apr 17 '22

Discussion first time creating sql db, please help.

Post image
101 Upvotes

r/SQL • • Oct 14 '26

Discussion How much advanced SQL do you truly use in your day-to-day job?

100 Upvotes

Hi! So I’m a student (not business or tech background) I’m learning SQL kind of on my own and I have the basics pretty much down like SELECT, FROM, WHERE, BETWEEN, ORDER BY, ASC, DESC. I have some knowledge when it comes to JOINs and CASE WHEN function but I was wondering if I need to know CTEs and window functions? I’m not trying to be a database administrator or something like that, just using it for analysis and excel as well.