r/learnSQL • u/SeatBig7948 • 5h ago
MySQL
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 • u/SeatBig7948 • 5h ago
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 • u/Bright-Opposite-1808 • 12h ago
r/learnSQL • u/nighthaven • 1d ago
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 • u/sumiitCodes • 1d ago
Over the last two days I covered ArrayList and LinkedList in Java, and I took a two-step approach to each:
Using the Collections framework and its built-in methods
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 • u/BananaThat5093 • 1d ago
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 • u/No_Ambition8323 • 2d ago
Not every database has PIVOT, but you can do the same thing with CASE.
Say you have sales by month in rows:
| product | month | sales |
|---|---|---|
| A | Jan | 100 |
| A | Feb | 150 |
| B | Jan | 200 |
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:
| product | jan | feb |
|---|---|---|
| A | 100 | 150 |
| B | 200 | 0 |
Works in almost every database. Do you use this trick, or do you prefer PIVOT?
r/learnSQL • u/incodelabs_ • 1d ago
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 • u/Bitter_Arrival5962 • 3d ago
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 • u/Inevitable_Paper_776 • 2d ago
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!
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 • u/sumiitCodes • 3d ago
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 • u/kixwho • 3d ago
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 • u/tidder78 • 4d ago
r/learnSQL • u/Due_Counter_2286 • 4d ago
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 • u/Lucifer77-7 • 3d ago
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 • u/No_Ambition8323 • 4d ago
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 • u/Due_Counter_2286 • 4d ago
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 • u/Due_Counter_2286 • 4d ago
r/learnSQL • u/carticka_1 • 4d ago
🚀 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 • u/Longjumping-Card7451 • 5d ago
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 • u/Mindless-Piece-47 • 4d ago
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:
r/learnSQL • u/sumiitCodes • 5d ago
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 • u/Spiritual_Potential4 • 5d ago
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:
LEFT JOIN: https://practisheet.com/blog/sql-left-join
Window functions: https://practisheet.com/blog/sql-window-functions
HAVING vs WHERE: https://practisheet.com/blog/sql-having-vs-where
Feedback welcome, especially where you got stuck and the hint didn't help.
r/learnSQL • u/SrdzanK3 • 5d ago
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/.dbfiles 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!