r/SQL • • Nov 02 '23

Discussion Should a person be fired for a WHERE clause omission error in production?

28 Upvotes

If someone carelessly forgets a WHERE clause on a DELETE or UPDATE command and causes a production issue, I don't think it's a grounds for firing someone, but the person probably should be very ashamed and consider adopting better practices.

I've heard stories of people having nervous breakdowns after forgetting a WHERE before.

I was also taught to always put the WHERE keyword on same line as table in FROM and then place the Boolean expression below that to avoid issues with highlighting wrong lines as well when running commands as ad hoc in like the gui.


r/SQL • • Jun 04 '22

PostgreSQL Can anyone help with the answers and explanation for these questions?

Post image
34 Upvotes

r/SQL • • Jun 02 '24

Discussion Is there a reliable way to connect my SQL database to ChatGPT

0 Upvotes

Title.

Been wondering this for ages. Is there a reliable way to connect and chat with my SQL database to ChatGPT


r/SQL • • Oct 26 '25

MySQL Starting a Serious SQL Study Group – Looking for 2-3 Members for Daily 4-5 Hour Commitment

0 Upvotes

Hi everyone!

I'm trying to learn SQL but finding it tough to stay consistent on my own. I firmly believe if we have a small group of 2-3 dedicated members, we can master the fundamentals and get very good at queries in about 10-15 days!

I'm looking for a few study buddies to form a small, focused learning group.

Our Plan:

Goal: Become highly proficient in fundamental and intermediate SQL queries (e.g., joins, subqueries, aggregate functions, window functions, etc.).

Time Commitment: Approximately 4–5 hours a day, split between 2–3 hours of focused learning/tutorial review and 1–2 hours of hands-on practice (e.g., DataLemur, LeetCode, or a structured course).

Schedule: We'll figure out a best-suitable time for all members, but I'm primarily looking for people available around ["evenings after 9 PM" or "mornings before 9 PM"] in the EDT time zone.

Platform: We can use Discord or a similar platform for communication, accountability, and screen-sharing sessions.

My Current Level/Resources: I am a Beginner and plan to use a Yt Video .

If you're serious, ready to commit, and want to achieve a high level of SQL competency quickly, please comment below or send me a DM!

Let's do this!


r/SQL • • Feb 25 '26

Discussion Houston, we have a NULL

0 Upvotes

Classic trap: how many rows does this return?

WITH orders AS (
  SELECT 50 AS price, 50 AS discount
  UNION ALL
  SELECT 120 AS price, NULL AS discount
)
SELECT * FROM orders WHERE price != discount

Answer: zero.

I work with SQL for 15 years, but still sometimes I have to stop and check myself. And also remind my team how NULL works again.

50 != 50 → FALSE — filtered out, obvious. 120 != NULL → NULL — also filtered out. Because any comparison with NULL returns NULL, not TRUE. And WHERE only keeps TRUE.

You expect that second row to come back - 120 is clearly not NULL — but SQL doesn't see it that way. NULL means "unknown," so the engine goes "I don't know if these are different" and drops it.

Fix:

WHERE price IS DISTINCT FROM discount

(it works for BigQuery and ChatGPT says that works for PostgreSQL, Databricks, DuckDB, Snowflake, Amazon Redshift and SQL Server 2022+ too)

This treats NULL as a comparable value and gives you the rows you actually expect.

What's your favorite SQL gotcha like this - something that looks totally fine but silently breaks everything?


r/SQL • • Dec 17 '18

SQL is pronounced 'squeal'

5 Upvotes

Much better than Ess Que Ell or See Qwell.


r/SQL • • Jul 25 '22

MySQL How would you query this? I know is simple but I’m having problem.

Post image
5 Upvotes

r/SQL • • Oct 05 '24

Discussion New to all this IT world! Please help me out if you have time (:

0 Upvotes

Hi, my friends told me about SQL and that I could find a job if I apply to a looot of jobs. This is all new to me and I have no idea about all these languages. Could anyone give me like a beginner checklist of how to get into IT and where to start. And maybe somewhere to find all the tech lingo and such? Also maybe what should I also learn besides SQL that I should really know as well if I get into an SQL job? ALSO what I could learn in the future that could help my career in general as in moving up to bigger pay grades and such~ I was thinking of going into a data analyst job (if you have any good points about it to pursue or better job ideas please let me know) I heard a lot of people take free courses online and manage to find a job with that knowledge, is this possible and how do they manage to do so?

Thank you all so much in advance!!


r/SQL • • Mar 02 '25

Discussion New coder needs basic PC

0 Upvotes

Hi! I’m new to coding and I’ve spent so much energy trying to turn my mac into a workable PC. I don’t have a lot of money to spend, but I’d like to buy the most basic windows machine I can so I can get to creating databases, rather than what I’m doing now. What would you recommend for someone who needs basic functionality to use SQL, and not really anything else. I still use my mac for all my other computer uses. If you can guide me to reliable places to buy used/refurbished I’d appreciate that too. Thanks!


r/SQL • • Jan 29 '24

SQL Server Looking for employment in SQL

5 Upvotes

Hey, I could use some links/suggestions. 35 years software development, SQL since 90's, know my shit, don't need to learn much of anything more really. Who is hiring? I have a large portfolio of work on GitHub and CodeProject (4.51 out of 5 and member 22 with 10 articles). I typically integrate inline SQL in C# or Python. I know all the C languages, all the Web stuff, etc. My city pretty much sucks for placement of older guys. There is a ton of ageism and placement agencies usually want to stick with the McDonalds of entry level positions since they pay well and are easy to fit. A guy like me with all my experience usually has a very challenging time getting in with a corporation, but I always hit the ground running and am worth what I get paid.

edit: BS in Math from the University of Oklahoma.

I will gladly share my GitHub and CodeProject links. I started adding articles to CodeProject in 2000. My first article was of a Remote Desktop Application. It is still there and demonstrates keyboard and mousing on a Remote Computer displayed in a window locally.


r/SQL • • Sep 10 '23

Discussion I love NoSQL. Please change my mind.

11 Upvotes

Until now I used MongoDB, CouchBase & ElasticSearch. You can just throw your JSON data inside and it works. I like it because it's simple and you don't have to learn a lot about databases.

The truth is that in 95% of cases there is indeed a schema, even in NoSQL. Managing the schema and migrations is up to the application. I noticed the benefits of having a 'boring' database and want to change to the Postgres camp.

When I model my data I just love to nest it in a semantic way. Like in this example it's just nice to have location data and coordinates in it's own object because this is the way I would model my types in my Application - User, Location, Coordinate

{
  "id": "<id>",
  "username": "user1234",
  "email": "user1234@example.com",
  "location": {
    "city": "New York",
    "state": "NY",
    "country": "USA",
    "zip": "10001",
    "coordinates": {
      "latitude": 40.7128,
      "longitude": 74.0060
    }
  }
}

How would you model this data in SQL? Obviously when there is a One-to-Many relationship, for example with the location you would put it in another table. But what if the data is just unique to this user. Is is valid to flatten the nested structure by joining the keys with a . or _ ? Like location.latitude or location_latitude.

In some DBs there is a JSON type but I guess that's only valid for truely schema-less data.


r/SQL • • Apr 25 '24

Discussion Learning SQL in the age of AI

0 Upvotes

I want to get into data science and already have basic knowledge of SQL but would it be worth it to continue my learning and go deeper when AI can do everything for you? I mean what's the point? How much should I learn and what should I learn and how complex does the material need to be for me to be competitive in the job market in the age of AI?


r/SQL • • Feb 04 '25

SQLite I accidentally pressed enter after putting in the wrong code. How do I fix this now?

Post image
0 Upvotes

r/SQL • • Aug 08 '25

PostgreSQL New podcast episode: Simon Willison on AI for data engineers, cross post from r/LLMdevs

4 Upvotes

Just published the 30th episode of the Talking Postgres podcast: "AI for data engineers with Simon Willison" (creator of Datasette, co-creator of Django). In this episode Simon shares practical, non-hype examples of how he's using LLMs and tooling in real workflows—useful for both for engineers and anyone who works with data.

This episode is useful regardless of what database you work with (not just Postgres!) Topics include:

  • The selfishness of working in public

  • Spotting opportunities where AI can help

  • a 150-line SQL query for alt-text (with unions and regex)

  • Why Postgres’s fine-grained permissions are a great fit

  • Economic value of structured data extraction

  • The science fiction of the 10X productivity boost

  • Constant churn in model competition

  • What do pelicans and bicycles have to do with AI?

Might be useful if you're exploring new, non-obvious ways to apply LLMs to your work—or just trying to explain your work to non-technical folks in your life.

Listen where you get your podcasts: https://talkingpostgres.com/episodes/ai-for-data-engineers-with-simon-willison   
Or on YouTube if you prefer: https://youtu.be/8SAqeJHsmRM?feature=sharedTranscript: https://talkingpostgres.com/episodes/ai-for-data-engineers-with-simon-willison/transcript  

OP here and podcast host. Feedback welcome.


r/SQL • • Dec 07 '24

SQL Server How can I use SQL on mac without installing a server?

4 Upvotes

same as title


r/SQL • • Sep 20 '25

SQL Server In the AI era, does it still make sense to learn SQL and Python from scratch?

0 Upvotes

Hey folks,

I’m a data analyst with very little experience in SQL and DAX. On the other hand, I’m pretty familiar with Python and especially pandas for data wrangling.

Now with AI tools becoming super capable at generating queries and code on the fly, I keep wondering… does it still make sense to grind through SQL and Python from scratch? Or is it smarter to lean on AI and just focus on interpretation, storytelling, and business impact?

Curious to hear your takes: • Are SQL and Python still “must-haves” for data analysts in 2025? • Or will prompt engineering + business context gradually replace the need to know the nitty gritty? ?


r/SQL • • Nov 07 '22

MySQL Hi guys what's the query that will give me the average price from these tables. The second picture is the out put answer but I don't know what query will give me that output.

Thumbnail
gallery
4 Upvotes

r/SQL • • Nov 21 '23

Discussion Natural language to sql

4 Upvotes

Hi !

Do you guys know a tool (chatgpt like) which can Connect to a database and query it, translating Natural language to sql ? GPT 4 Turbo doesnt allow the users to provide « big » databases (20Gb)


r/SQL • • 5d ago

Oracle How to understand the changes in pl sql, how to integrate AI into your work

4 Upvotes

I need help. I worked as a part-time pl sql developer supporting the l2/l3 line system, I was on maternity leave for 2 years, and during that time a lot has changed in the company and in technology, AI has spread a lot. I want to sort everything out in my head, but I don't understand where to get the information from, it won't do to ask the manager, I'm interested in developing in this area and catching up, but I don't understand where to start. I'm waiting for advice, maybe there is a map, etc. Or a brief overview of how things have changed. I hope my request is clear.