r/learnSQL • • 5h ago

MySQL

1 Upvotes

I want to understand how to use MySQL on VS code and run the code SQL in MySQL,and connect the file SQL in SQL tools?


r/learnSQL • • 12h ago

Looking for unique, real-world database project ideas (MS SQL Server + C#)

Thumbnail reddit.com
2 Upvotes

r/learnSQL • • 1d ago

Title: Day 68-69 — Combined update: Java ArrayList and LinkedList, both with the Collections framework and built by hand

3 Upvotes

Over the last two days I covered ArrayList and LinkedList in Java, and I took a two-step approach to each:

  1. Using the Collections framework and its built-in methods

  2. Writing the same functionality myself without the framework

Doing the second step is what made the difference. Building the logic by hand showed me why the two structures behave differently, and made the usual “when to use which” explanations make sense. I made notes on both and practiced everything in VS Code.

Tomorrow I’m moving on to HashMap and HashSet.

For people who’ve learned collections: did you build the structures yourself too, or did you find it enough to learn the framework methods? And how did you decide when LinkedList is actually worth using over ArrayList?


r/learnSQL • • 1d ago

Really struggling with the concept of KEYS

18 Upvotes

I have been teaching myself SQL in Snowflake for about the past few weeks at work as it is now part of my job. I've been able to understand almost every part of the basics from SELECT to FROM to ORDER and other beginner things but those damned PRIMARY, HASH, and FOREIGN keys that are completely eluding my understanding.

I have access to the directory of all of our tables and whatnot, but when I see a HK or a HK_FK or am asked what a PRIMARY key is I freeze up because it's like I hit a mental block.

Is there an "Explain Like I'm 5" way of describing what keys are and how they're used? It will only help me in the end if there is a way.


r/learnSQL • • 1d ago

31 returns last week, 58 this week: write the explanation before reading the example

0 Upvotes

You're preparing a short update for your team. Last week had 31 returns; this week had 58. What would you write?

Keep your first two sentences before reading further. This is a made-up case from CareerTree's “Explain a weekly change” practice.

Here is a self-contained SQLite example:

WITH weekly_returns(week, returns_count) AS (
  VALUES ('last_week', 31), ('this_week', 58)
)
SELECT
  (SELECT returns_count FROM weekly_returns WHERE week = 'last_week') AS last_week,
  (SELECT returns_count FROM weekly_returns WHERE week = 'this_week') AS this_week,
  (SELECT returns_count FROM weekly_returns WHERE week = 'this_week') -
  (SELECT returns_count FROM weekly_returns WHERE week = 'last_week') AS increase;

The result is 31, 58 and an increase of 27 returns. The table contains counts for two weeks. It has no product breakdown or sales totals.

One possible explanation:

Returns rose from 31 to 58, an increase of 27. I'd check which products came back and compare sales volumes before recommending a change.

Put that beside your first answer. Look at the numbers and the next check each explanation includes. Keep your own wording so you can revisit the difference later.

We build CareerTree at Incode Labs. In the app, you can save your explanation, compare with an example and keep a new attempt alongside your earlier work. Come back to see which evidence and checks you added.

Keep your first explanation in CareerTree: https://careertree.app/mobile.html?utm_source=reddit&utm_medium=social&utm_campaign=ct-rd-01

Free download on iPhone and Android, with ads and optional purchases. Availability varies by store region. This post was prepared with AI writing assistance. The SQL example was checked in SQLite.


r/learnSQL • • 1d ago

SQL in business/strategy operation roles

3 Upvotes

I have come across a lot of strategy operations and business operations role which require proficiency in SQl.

Since I am wanting to get into such roles, could someone guide me on how deep is the SQal requirement? Is it just to leverage datasets or is it very advanced? How can a beginner in SQL get started and how long tk reach enough knowledge to be eligible gor such roles? Do they only use JOINs, Union, basic stuff?

Thanks!


r/learnSQL • • 2d ago

Turn rows into columns without PIVOT, using CASE

28 Upvotes

Not every database has PIVOT, but you can do the same thing with CASE.

Say you have sales by month in rows:

productmonthsales
AJan100
AFeb150
BJan200

And you want each month as a column:

SQL:
SELECT product,SUM(CASE WHEN month = 'Jan' THEN sales ELSE 0 END) AS jan,SUM(CASE WHEN month = 'Feb' THEN sales ELSE 0 END) AS feb FROM sales GROUP BY product;

Result:

productjanfeb
A100150
B2000

Works in almost every database. Do you use this trick, or do you prefer PIVOT?


r/learnSQL • • 2d ago

Ruddy is now running DuckDB 2.0!

3 Upvotes

Hey everyone,

I’m an independent developer who started building Ruddy in my free time: a fast, modern macOS IDE for data management, analysis, and data science powered 100% by DuckDB.

With this new release, the core engine has officially been upgraded to DuckDB 2.0!

Ruddy runs on a true Pay-What-You-Want (PWYW) model—support independent development with whatever you feel it’s worth, or start exploring for free.

Check it out: ruddy.pro

I’d love your thoughts, benchmark requests, or features you'd like to see next!

What’s inside Ruddy:

  • DuckDB 2.0 Core Engine: Blazing-fast columnar processing over local files, Parquet, Arrow, CSV, and Iceberg/Delta Lake tables without spinning up heavy infra.

  • Multi-Cloud Direct Querying: Federate and query across AWS S3, Cloudflare R2, Google Cloud Storage, Azure Blob, and MotherDuck seamlessly in a single SQL statement.

  • Reactive Notebooks & Marimo: Build reproducible, reactive Python data science notebooks that sync directly with your in-memory DuckDB tables.

  • First-Class Geospatial Analytics: Full DuckDB spatial extension support—render GeoParquet, Shapefiles, and spatial geometries interactively on high-performance maps.

  • Auto-Ontology & Modular Semantic Layer: Automatically infers FACT/DIMENSION roles, deduces canonical SQL metrics, verifies joins via physical data overlap, and generates Open Semantic Interchange (OSI v1.0 / Apache Ossie) YAML specifications per dataset domain.

  • Context-Aware AI Assistant (Ruddynie): Text-to-SQL agent grounded in your workspace ontology and self-improving query memory—zero phantom table or join hallucinations.

  • Model Context Protocol (MCP) Integration: Expose your DuckDB catalogs, query tools, and semantic context to any external MCP-compatible AI agent or client.

  • Built-in Git Version Control: Track schema migrations, SQL queries, notebooks, and semantic models with standard Git repositories right from the workbench.

  • Force-Directed Semantic Graphs & Visual SQL Builder: Explore domain schemas visually or drill down with interactive force-directed relationship maps.


r/learnSQL • • 3d ago

Title: Day 65-67 — Combined update: revised all my Java so far and started the Collections framework (ArrayList)

5 Upvotes

After building two OOP projects, I used these three days to revise everything I’ve covered in Java, then moved on to a new topic: the Collections framework, starting with ArrayList.

Tomorrow I’m covering LinkedList, HashMap, and HashSet. For each one I plan to write a small exercise based on a real-life situation (for example, a contact book for HashMap, or removing duplicate entries with HashSet), because I learned from SQL that I remember a topic much better when I use it on something concrete.

For people who’ve learned collections: which real-life exercises helped you understand when to pick one collection over another? I’m especially unsure about LinkedList, since ArrayList seems to cover most cases.


r/learnSQL • • 3d ago

The one-character bug that fails a lot of SQL interview answers

0 Upvotes

A pattern I keep seeing when people practice SQL for analyst interviews.

The question: "Return every active subscription paying at least $1,500 a month."

A very common answer:

SELECT company_name, plan_tier, monthly_amount
FROM subscriptions
WHERE status = 'active'
  AND monthly_amount > 1500
ORDER BY monthly_amount DESC;

It runs, it returns rows, and it looks right. But "at least" means >=, so the customer paying exactly 1500.00 silently disappears. In an interview the query "works", so you don't notice. Against the expected output it's simply wrong.

Things worth checking every time a question has a threshold:

  • "at least" / "minimum of" -> >=

  • "more than" / "over" -> >

  • "between" -> BETWEEN is inclusive on both ends; dates with timestamps need care

  • Does the sample data contain a row exactly on the boundary? Interviewers often add one on purpose.

I built a free practice site around this kind of feedback: you write real PostgreSQL in the browser and it shows you which rows are missing or extra compared to the expected result. This exact problem is the first one, no signup: https://dbexercises.vercel.app/exercise/saas-active-subscriptions

Happy to hear what other "looks right, is wrong" traps you've run into.


r/learnSQL • • 3d ago

I am new to SQL , help me to find approach.

31 Upvotes

I started solving SQL questions since last week from youtube videos and LearnSQL I encountered new type of problems which I couldn’t solve or half solve or do hit & trial methods like new queries like - “ROUND,LIKE and more”.
But the main problem is I can’t memorise every new problem and solve thousands of problem.
In some questions i couldn’t find how to approach a problem like should i apply sub queries or Group by Or JOINS.

Is there any approach how to identify a problem?
What are the mistakes I should avoid while solving the questions or learning?
I am aiming for Data Analyst role, first I am trying to get grasp on these queries then i’ll move to CTE, window functions.
Thanks


r/learnSQL • • 3d ago

SQL cheat sheet table

9 Upvotes

Sharing my SQL cheatsheet table. This is meant to be a useful starter pack covering the essentials, in the quickest format I could think of: a table with examples.

https://github.com/kixwho/PostgreSQL-cheatsheet

Note: Based on Practical SQL (O'Reilly Media), a very good textbook. If there's another essential SQL concept you'd like to see included, just let me know! :D


r/learnSQL • • 4d ago

Keep hearing AI can write good SQL. Can AI write complex SQL involving Window functions, CTE etc for complex business purposes?

19 Upvotes

r/learnSQL • • 4d ago

Can a LEFT JOIN Accidentally Behave Like an INNER JOIN Without Changing the JOIN Condition?

12 Upvotes

If we apply a WHERE condition on a column from the right-side table after a LEFT JOIN, can it eliminate NULL rows and change the result? Are there cases where moving the condition into the ON clause produces completely different results? Why does this happen internally?


r/learnSQL • • 4d ago

What are some interesting SQL problems or query mistakes worth discussing?

5 Upvotes

I'm planning to share some SQL-related content on LinkedIn, but I want to avoid the usual beginner-level tutorials or generic interview questions.

I'm particularly interested in intermediate-level SQL concepts, window functions, CTEs, tricky query behavior, or situations where a query looks correct but produces unexpected results.

I'd love to hear from people working with SQL regularly.

What's an interesting SQL problem, subtle query mistake, or unexpected behavior you've encountered that made you think twice?

Looking for something technically meaningful that could spark a good discussion rather than another basic SQL tutorial.


r/learnSQL • • 4d ago

What are some interesting SQL problems or query mistakes worth discussing?

21 Upvotes

I'm planning to share some SQL-related content on LinkedIn, but I want to avoid the usual beginner-level tutorials or generic interview questions.

I'm particularly interested in intermediate-level SQL concepts, window functions, CTEs, tricky query behavior, or situations where a query looks correct but produces unexpected results.

I'd love to hear from people working with SQL regularly.

What's an interesting SQL problem, subtle query mistake, or unexpected behavior you've encountered that made you think twice?

Looking for something technically meaningful that could spark a good discussion rather than another basic SQL tutorial.


r/learnSQL • • 4d ago

What are some interesting SQL problems or query mistakes worth discussing?

Thumbnail reddit.com
3 Upvotes

r/learnSQL • • 4d ago

Superstore Dataset

6 Upvotes

🚀 Just published a new 3NF relational dataset on Kaggle!

I took the classic flat Superstore dataset and refactored it into a clean, normalized Third Normal Form (3NF) relational database structure.

By decomposing flat records into distinct dimension tables (dim_customers, dim_locations, dim_products) and header/line-item fact tables (fact_orders, fact_order_items), this schema eliminates data redundancy and enforces relational integrity.

Great for anyone looking to:

Practice multi-table SQL joins and data modeling

Build modular ETL ingestion pipelines

Stage realistic relational schemas for analytics projects

🔗 Check out the dataset on Kaggle: https://www.kaggle.com/datasets/kartikanidhi/superstore-database

#DataEngineering #SQL #DatabaseDesign #DataNormalization #Kaggle #OpenSource #Analytics


r/learnSQL • • 4d ago

MariaDB Foundation TAF: Profiling MariaDB Subsystems Across Hardware Using Targeted Performance Profiles

1 Upvotes

Just published a deep dive on how we profile MariaDB subsystems using TAF + HammerDB TPROC‑C.

Each profile flips exactly one switch (binlog, isolation, PFS, charset, threadpool, etc.) to measure subsystem cost cleanly and reproducibly across hardware.

If you’re interested in performance engineering or regression hunting, here’s the full article:

https://mariadb.org/mariadb-foundation-taf-profiling-mariadb-subsystems-across-hardware-using-targeted-performance-profiles/


r/learnSQL • • 5d ago

Beginner in SQL, can’t work in person. How can I land remote projects?

13 Upvotes

Hi everyone,

I’m a beginner in SQL and I’m looking for ways to start earning remotely. In-person work isn’t an option for me, so I’m focusing on freelance or remote opportunities.


r/learnSQL • • 5d ago

Title: Day 62-64 — Combined update: built and published a Car Rental System in Java (feedback welcome)

6 Upvotes

Over the last three days I built a console-based Car Rental System in Java, applying the OOP concepts from the past few weeks. Repo: https://github.com/Sumitgupta2005/Car_Rental_System

What it does:

  • Menu with three options: rent a car, return a car, exit

  • A Car class with private fields (ID, brand, model, base price per day, availability), a constructor, and getters

  • Asks for confirmation (Y/N) before completing a rental

  • Keeps the cars in a list and updates availability when a car is rented or returned

After the feedback I got here on my last project (don’t leave the errors for the end), I tried to test each part as I wrote it.

I’d appreciate a review of the code structure and README. What would you improve first: input validation, splitting into more classes, exception handling, or saving data to a file or database?


r/learnSQL • • 5d ago

[Showoff Saturday] I built a 100% client-side, in-browser SQLite editor using WebAssembly (No backend, offline-first)

2 Upvotes

I wanted to share a project I've been working on: sqliteWeb, a lightweight SQLite editor that runs entirely inside the browser. link online sqlite browser
I needed a fast way to inspect and query .sqlite / .db files on machines where I didn't want to (or couldn't) install desktop clients like DB Browser. Existing web tools often require uploading files to a remote server, which is a major privacy concern.

Would love to get your feedback on performance, UI responsiveness, or features you'd like to see added!

online sqlite browser


r/learnSQL • • 5d ago

I made SQL practice where you debug an AI's queries, and the hints never give you the answer

8 Upvotes

I'm learning-adjacent: I build tools for people learning SQL for analyst jobs, and this is mine, so it's self-promo. Mods, remove it if it doesn't fit.

What bugged me about practice sites is that a different toy table every time doesn't build the "I know this company's data" feeling you get at work. Practisheet uses one fictional company for everything, so by exercise 20 you know where revenue, refunds and late deliveries live.

How it works:

  • You write the query in the browser and it checks your result.

  • If it's wrong, you get a hint about your attempt (e.g. "you're counting order lines, not orders"). The answer is never shown, and after 3 tries you can skip.

  • It starts with SELECT/WHERE and goes up to window functions, CTEs and cohort-style questions.

  • About 1 in 4 exercises are "here's a query an AI wrote, find the bug", which I think is a skill people will need more and more.

The first 4 SQL exercises are free with no sign-up: https://practisheet.com/practice

Free guides that go with it, if you just want to read:

Feedback welcome, especially where you got stuck and the hint didn't help.