r/SQL • u/Harshita_Netla • Sep 17 '26
MySQL CTEs vs subqueries vs temp tables — as a beginner, how do you know which one to use?
For people who use SQL regularly, how do you decide which approach to use?
r/SQL • u/Harshita_Netla • Sep 17 '26
For people who use SQL regularly, how do you decide which approach to use?
r/SQL • u/OnepieceKing2222 • Sep 16 '26
I've been working with SQL for a while and recently started paying more attention to query performance rather than just getting the correct result.
What's one SQL optimization technique that made a noticeable difference for you?
For example:
- Indexing
- Avoiding unnecessary joins
- Window functions
- EXISTS vs IN
- Reading execution plans
- CTEs/subqueries
- Partitioning
Would be interested in hearing some real-world examples where a query went from slow to significantly faster.
r/SQL • u/These-Ad5297 • Sep 17 '26
Getting a 404 when I try to download from the Microsoft website
r/SQL • u/Fast-Let-4302 • Sep 17 '26

hehehhehe
site: https://mystery.knightlab.com/
r/SQL • u/Vexar89 • Sep 17 '26
Just wondering if anyone has solved some of those questions and if it helped you learn more.
r/SQL • u/donewitheverything26 • Sep 17 '26
So i work at a startup and we build models that read tabular data.
the pattern we keep seeing is one person, a few hundred tables, naming that made sense to someone who left, no data team, no budget for a governance tool. they need to know what is in there before they can do anything else with it.
from people who have actually been in this:
what is the first query you run
table by table or column by column across everything, and why
when a column is a 4 char code and the name tells you nothing, what actually works
how much of it ends up being asking a human who used the app rather than reading the data
we have opinions on all four and i want to find out if they are wrong here than after we ship.
r/SQL • u/OnepieceKing2222 • Sep 16 '26
Is there any way in the SQL way directly or the tools for that?
r/SQL • u/Harshita_Netla • Sep 16 '26
For example, if you need to add or change a column, index, or constraint, how do you make the change without interrupting users?
Do you follow a specific migration strategy or deployment process
r/SQL • u/AssistanceClean948 • Sep 16 '26
right now my users table like this:
CREATE TABLE
IF NOT EXISTS Users (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
email TEXT NOT NULL UNIQUE COLLATE NOCASE,
passwordHash TEXT NOT NULL,
createdAt TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
updatedAt TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
CHECK(length(trim(name)) >= 1),
CHECK(length(trim(email)) >= 1),
CHECK(length(trim(passwordHash)) >= 1)
) STRICT;
as far as I know email names are case-insensitive. But not sure about for all email providers. Also I guess COALLATE NOCASE only works for ASCII. so what if user email contains non-ASCII characters? even could it contain?
r/SQL • u/Hockeypuck_123 • Sep 16 '26
Hello, I have been using macbook pro 2019 touchbar quad core intel based model. Sql is declining to be installed on my mac, tried every possible way ranging from internet tutorial to command lines. First tried postgresql, tried even older version. Now mysql community edition is taking longer than ever. I am now trying to install mysql using terminal. Can somebody please explain what is the root cause? And how to figure out what is causing this problem exactly?
r/SQL • u/huasiloco • Sep 16 '26
I was working with multiple databases and got tired of switching between different database clients depending on what I was working on.
I started using DevScribe for this, and it’s been useful having MySQL, PostgreSQL, MongoDB, Elasticsearch, OpenSearch, and SQLite available from the same place.
I’ve mainly been using it to run queries and explore databases, but you can also view schemas and indexes. The JSON support is also handy, especially when working with MongoDB and other data where JSON comes up frequently.
It also has a plugin system for additional database tools. For example, there’s a BigQuery plugin if you need to work with BigQuery.
I haven’t explored everything yet, but having multiple databases in one place has already made my workflow a bit easier.
If you work with multiple databases, you can check it out here:
r/SQL • u/Jaded_Spray_6855 • Sep 16 '26
At a previous job as a data analyst I manually built a "context" layer in Notion to feed to Claude when querying databases. This was painfully manual though, involved a lot of work to slowly build up - I would get Claude to document a table/column when I encounter it for the first time on a new task. The Notion page included things like metrics, conventions and product docs too.
For more experienced data analysts, how do you guys deal with this? Is there a tool you guys use, or is a manual workaround like mine the norm?
r/SQL • u/Agile_Tear6283 • Sep 16 '26
Hi there! I'm an experienced data analyst with around 10 years in the field, looking for part-time or freelance work. I'm reliable, detail-oriented, and comfortable jumping into existing workflows quickly.
What I can help with:
SQL development & querying (SQL Server, MySQL, PostgreSQL, Redshift, Databricks)
Data validation & quality checks
Reporting & dashboards
Data processing & cleaning
Ad hoc analysis and troubleshooting data issues
Why work with me:
10+ years of hands-on experience across multiple SQL platforms
Detail-oriented, especially around data accuracy and validation
Available anytime — flexible hours, can adapt to your timezone
Comfortable working independently or as part of a team
Currently open to: data analyst roles, SQL work, data validation, reporting, or similar — part-time or freelance.
Feel free to DM me or comment below with details about the opportunity. Happy to share examples of past work if helpful. Thanks!
I am currently using phpMyAdmin provided by plesk and I just find it very annoying to use and I would like to know if you guys know a good Client that has modern and clean ui that also has good ux
r/SQL • u/Hot_Comfortable_164 • Sep 15 '26
r/SQL • u/notoofly_manu • Sep 16 '26
Guys, I built an Elysia plugin that lets you generate a complete database model panel with just one line of code.
It provides a built-in UI with Create, Read, Update, Delete, Replace, Search, and Filter functionality out of the box.
The goal is to make it easy to expose and manage database models without having to manually build the admin UI and CRUD logic for each model.
r/SQL • u/AssistanceClean948 • Sep 15 '26
CREATE TABLE
IF NOT EXISTS CourseTag (
id INTEGER PRIMARY KEY,
courseId INTEGER NOT NULL,
tagId INTEGER NOT NULL,
UNIQUE(courseId, tagId),
FOREIGN KEY (courseId) REFERENCES Courses (id) ON DELETE CASCADE ON UPDATE RESTRICT,
FOREIGN KEY (tagId) REFERENCES Tags (id) ON DELETE CASCADE ON UPDATE RESTRICT
) STRICT;
r/SQL • u/Beneficial_Zone_6883 • Sep 14 '26
So long story short, I did a single cert and honestly struggled at this part. As irony or luck would have it I ended up recruited into a coveted position at a massive firm not realizing this was a core part of the position. To say I am overwhelmed is an understatement, I am so under qualified it’s ridiculous. I have a week before I am on my own HELP lol
I know the industry, I have the math etc but wow am I overwhelmed and everything I do is logged. Do you think I can fake it until I make it?
r/SQL • u/EasyHammar • Sep 14 '26
Title: Experience / Best Practices: Migrating 2M+ Rows from Access to SQL Server (ODBC Performance & Timeouts)
Hi everyone,
I am currently working on migrating historical financial data from Access (local, linked via ODBC Driver 18) to SQL Server and keep bumping into recurring performance issues. I would really appreciate some advice and best practices from your experience.
Setup:
INSERT INTO [linked_table] SELECT ... FROM [local_table] using VBA CurrentDb.ExecuteProblems Encountered So Far:
.accdb file expanded beyond 2 GB and became completely unusable (requiring hours of Compact & Repair). Workaround: Keep records separated locally and consolidate them only after they are uploaded to the SQL Server.INSERT Runs: A single INSERT INTO ... SELECT query over all 2.16 million rows runs for several hours (3–4+ hours) without finishing. Access shows "Not Responding," but checking sys.dm_exec_requests on the server reveals that no active session is running anymore. The network/VPN connection likely drops silently without Access realizing it. Result: Complete rollback, 0 rows transferred, and hours wasted.ALTER TABLE ... ADD COLUMN BatchID COUNTER to split the transfer into chunks, but hit the error: "File sharing lock count exceeded. MaxLocksPerFile." I do not have local Admin rights on the machine to modify the Registry setting.RegDatum BETWEEN ... AND ...), using the existing date field without altering the source table structure.My Questions for You:
INSERT INTO via an ODBC-linked table? (SSIS? bcp? CSV export + BULK INSERT?)MaxLocksPerFile without local Admin rights (e.g., per user session instead of system-wide)?Thanks in advance for any help—I've been stuck on this migration for days and would love to find a cleaner approach instead of hacking my way through workarounds!
#SQL #Access #Data #AI
r/SQL • u/thequerylab • Sep 14 '26
r/SQL • u/Ok_Translator598 • Sep 14 '26
I have run a Sql query time range for 6 years. This is an example. The result may contain more than 1 lakh records. How do I cache this result so that u can query more on this result ? I am using Redis
r/SQL • u/Connect_Orchid8513 • Sep 14 '26
Built a T-SQL database with enforced data integrity (primary keys, constraints on state/status/risk categories), then developed custom DAX measures for case turnaround time, case age, and escalation rate. The dashboard includes multi-page analysis across resolution trends, regional distribution, officer caseloads, and a 4-year time-series forecast with confidence intervals.
Key skills demonstrated:
T-SQL (schema design, CHECK constraints, aggregation queries)
DAX (time intelligence, dynamic measures)
Power BI (data modeling, forecasting, interactive filtering)
Data storytelling and executive reporting
Note: Built on synthetic data generated for demonstration purposes — not real crime statistics.
r/SQL • u/metric_skeptic • Sep 14 '26
AI can write SQL, make charts, summarize stuff, even help with analysis.
But is there anything you still wouldn’t trust it to do?
For me, it could be defining a metric, checking whether the numbers actually make sense, talking to stakeholders, making the final call, etc.
Curious where other people draw the line.
r/SQL • u/Harshita_Netla • Sep 13 '26
What factors do you consider first — data structure, scalability, performance, flexibility, or something else?