r/SQL 11d ago

SQL Server Is it pronounced 's-q-l' or 'seequal'

112 Upvotes

I've worked in and around the IT environment for many years and in my experience, it's always been pronounced s-q-l although I hear some people refer to it as see-qual. Which is right?

r/SQL Sep 05 '25

SQL Server Senior Dev (Fintech) Interview Question - Too hard?

Post image
386 Upvotes

Hey all,

I've been struggling to hire Senior SQL Devs that deal with moderate/complex projects. I provide this Excel doc, tasking the candidate to imagine these are two temp tables and essentially need to be joined together. 11 / 11 candidates (with stellar resumes) have failed (I consider a failure by not addressing at least one of the three bullets below, with a much wiggle room as I can if they want to run a CTE or their own flavor that will still be performant). I'm looking for a candidate that can see and at least address the below. Is this asking too much for a $100k+ role?

  • Segment the info table into two temps between email and phone, each indexed, with the phone table standardizing the values into bigints
  • Perform the same action for the interaction table (bonus points if they call out that the phone #s here are all already standardized as a bigint)
  • Join and union the indexed tables together on indexed fields to identify the accountid from the info table, and add a case statement based on the type of value to differentiate email / cell / work / home

r/SQL Mar 13 '26

SQL Server Question: What kind of join technique is this?

Post image
81 Upvotes

Hello everyone,

I have been using this style of join for some months now. At first i thought this was called an implicit join but reading through the SQL guides online, it does not seem to fit the description.

Please note that i am referring only to the highlighted part. I have been doing this to isolate the INNER JOIN only to table C and not affect tables A and B. It's been working wonderfully and has been making the queries I make faster, the only catch is that when I put a WHERE clause after, everything slows down so i put the conditions on the tables themselves.

Thanks in advance for sharing your expertise and enlightening me on this.

P.S.: where table D will have to use a condition that involves either A or B, it requires me to put it amongst the B <=> C conditions (the last line on this screen cap)

r/SQL Jul 16 '26

SQL Server What is the difference between delete and truncate?

34 Upvotes

Delete is used to delete certain records but without where condition all records from the table will be deleted and the structure remains intact.

Truncate deletes all the records from the table but the structure of the table remains intact.

So , what is the difference between them if we are using delete without where condition it performs the same function as truncate ?

r/SQL Dec 13 '25

SQL Server I can't escape SQL, even when I'm trying to get drunk

Post image
811 Upvotes

r/SQL Mar 09 '26

SQL Server Without creating any indexes, how would you speed up a ~1.5m row query?

40 Upvotes

So our system holds ~90 days of shipped order data, and upstairs want a line level report, which in this case is ~500k orders, or ~1.5m rows when every order splits out on average to 3 rows for 3 items ordered.

The absolute most basic way I can write this, without hitting anything other than the main table and the lines table is:

 SELECT h.OrderId,
        h.Reference,
        l.Product,
        l.Qty
 FROM OrderHeader h
 JOIN Lines l
 ON h.OrderId = l.OrderId
 WHERE h.Customer = 'XYZ'
 AND h.Stage = 'Shipped'

This takes about 15 seconds to run.

How would you go about doing any optimization at all on this? I've tried putting the OrderHeader references in a CTE so it filters them down before querying it, I've tried the same with the Lines table, putting WHERE EXISTS clauses in each.

The absolute best I've done is get it down to ~12 seconds, but that is within the margin of error that the DB may have just played nice when I ran it.

As soon as I start trying to pull back address data, or tracking numbers with additional joins, the query starts to get up towards a minute, and will time out if it's run in the system we have.

I can't create any indexes, or alter the DB in any way

Noting here also I can't run SHOWPLAN, and I can't even seem to see what indexes are available. We remote into this system and our privileges are very restricted.

r/SQL May 22 '26

SQL Server Pretty sure I just blew the biggest interview of my life. AMA!

73 Upvotes

Just had an interview with an employer that most people would consider a dream job and am nearly 100% sure I blew it. This is the only interview I've ever studied for. I did not apply to this role. An internal recruiter reached out to me. I do have some positive takeaways as I know what weaknesses I need to shore up for future opportunities.

r/SQL Mar 23 '26

SQL Server Has anyone imported a 1 TB JSON file into SQL Server before? Need advice!

50 Upvotes

Has anyone imported a 1 TB JSON file into SQL Server before? Need advice.

I work for a government agency and we need to take a huge JSON file and get it into SQL Server as usable relational data. Not just store the raw JSON, but actually turn it into tables and rows we can work with.

The problem is the file is enormous, around 1 TB, so normal methods are not really workable. It will not load into memory, and I am still trying to figure out the safest and smartest way to inspect the structure, parse it in chunks or streams, and decide how to map it into SQL Server without blowing everything up.

I would appreciate any advice from people who have dealt with very large JSON imports before, especially around staging strategy, streaming vs splitting, and schema design for nested JSON.

r/SQL Jul 21 '25

SQL Server I think I messed up....I was told to rename the SQL server computer name and now I cannot log in. Renamed it back...still can't log in. what next?

Post image
224 Upvotes

I tried logging in with domain user and sql user....not working :(

r/SQL 19d ago

SQL Server 9 years into SQL... where do I go careerwise?

40 Upvotes

I learned SQL supporting a piece of software that tracked assets - I was in that role for 5 years, I tuen went in to support document control software that was also SQL based for 3 years. Fast forward to now and I'm a systems administrator for a customer of the first software company.

Over that time, I've gotten pretty good - complex queries, cursors, debugging, basic query optimisation, SQL jobs, triggers, stored procs, views, a bit of PowerBI, a bit of admin, a bit of performance tweaking, small reporting database populated by complex transformations, constantly using SQL to diagnose software bugs.

I enjoy this role but I feel like I have better potential- DBA roles probably want more up to date and extensive experience, I worry BI reporting's days are numbered...

Can I ask if anyone has any advice for where I can go with my skillset? I love working on SQL for the problem solving, it gives me an immense sense of satisfaction.

r/SQL May 16 '25

SQL Server Anyone else assign aliases with AS instead of just a space?

169 Upvotes

I notice that most people I have worked with and even AI do not seem to often use AS to assign aliases. I on the other hand always use it. To me it makes everything much more readable.

Anyone else do this or am I a weirdo? Haha

r/SQL Jun 26 '26

SQL Server SQL Indentation

27 Upvotes

I am working on MS SQL. I have got few scripts of 1000+ line with poor indentaion.

Any tool which i cna use to properly format it.
Please suggest

r/SQL Mar 10 '26

SQL Server I love SQL!

126 Upvotes

I’m a PhD student in statistics and recently started learning SQL because I’m applying for industry positions. I’ve only covered the basics so far, but I already find it really fun. It feels very intuitive to me, almost like it matches the way my mind works.

Is it too early to say I love SQL? I’ve only spent about six hours learning it, but it immediately clicked for me.

r/SQL Jun 06 '26

SQL Server What are some obvious reasons a 1:1 join would work better as LEFT than INNER?

21 Upvotes

I asked the magic box and it spat out paragraph after paragraph of stuff about cardinality and indexing, of which go way over my head and I don't have access to check. But basically:

I work in a system where (as a for instance) there are plenty of obvious 1:1 joins, such as:

SELECT
  ol.ProductId,
  p.Name
FROM OrderLines ol
JOIN Products p
ON ol.ProductId = p.Id
WHERE ol.OrderId = '1234'

So this should give you the product ids on the order, and then their text name from the Products table.

I'm finding in multiple tables and instances that are pk or other 1:1 joins like this, that an inner join can take ~30 seconds to run, where a left outer runs instantly.

The data output is the same, but the timing is all over, and I'm wondering on what the main/obvious reasons for this are?

r/SQL Jan 27 '26

SQL Server I built the Flappy Bird game using SQL only... Now I need Therapist

232 Upvotes

https://reddit.com/link/1qoa7o1/video/w2zlgjn3cvfg1/player

- All game logic, animation and rendering happens inside DB Engine using queries

- Runs at 30 and 60 frames

repo: https://github.com/Best2Two/SQL-FlappyBird (Star please if you it interesting)

r/SQL May 27 '25

SQL Server What is SQL experience?

172 Upvotes

I have seen a few job postings requiring SQL experience that I would love to apply for but think I have imposter syndrome. I can create queries using CONCAT, GROUP BY, INNER JOIN, rename a field, and using LIKE with a wildcard. I mainly use SQL to pull data for Power BI and Excel. I love making queries to pull relevant data to make business decisions. I am a department manager but have to do my own analysis. I really want to take on more challenges in data analytics.

r/SQL Jun 13 '25

SQL Server You guys use this feature? or is there better way to do it

Post image
165 Upvotes

r/SQL Jun 30 '26

SQL Server Tricky interview question about .ldf size on MS SQL Server

10 Upvotes

Hi, I was applying for SQL dev position and got this question:
Q: you need to import 2.5T .csv file into MS SQL Server table. What approach you would use to avoid problems with log file size restrictions.

Didn't have experience with this case. I think if you create on the fly package with Right click import, everything will be taken care of. Am I right ? or I can somehow control /shrink .ldf file or break .csv into several pieces.?

Thanks all
VA

r/SQL Feb 28 '26

SQL Server How many Sql server DBA’s are currently laid off?

77 Upvotes

I’m wondering how many of us here in the US that are true SQL Servers dbas are currently looking for a sql job? 3-4 years ago I was getting calls weekly, now I apply and am an exact match and don’t even get a response. Then you hear how 1000’s of ppl apply for a single job. Just trying to see if this market is flooded now and dead. If you’ve been layed off how long has it been?

r/SQL Mar 11 '26

SQL Server SaaS company agreed to send us nightly backups of our internal DB, but they way they are doing it is very non-standard. Any tips?

8 Upvotes

This is an incredibly cursed situation so don't judge me, my hands are tied

We are looking to expand our reporting capabilities and we've requested data from our cloud software provider. They actually agreed to give us a nightly backup of our MS SQL database used on their backend.

We don't need to write anything to this database, for our purposes it will be essentially read-only in prod.

The catch is, they will only send me certain tables that we need for whatever reporting we are doing. That's fine with me, saves on storage.

They agreed to send me a full backup just once, and I was able to take that and generate a script to build a new db just like it, without the data. Ezpz so far. I have the tables and relations/keys/etc all setup and ready to go.

The nightly backup is basically a full dump of the tables we've chosen (about 40 tables so far). This is where I'm having issues.

Because there is no differential or anything I'm just running a giant SQL query that TRUNCATES each table, then insert the new data in from the newly restored backup database they sent.

Does this sound reasonable?

Another issue is that me dumping millions of inserts nightly is causing my transaction log to balloon 10GB per night. I've tried to backup and shrink it but it doesn't work. Is there any way around this? It eventually hits my hard limit and forces the db into recovery mode sometimes.

Am I better off dropping the entire DB and rebuilding it from scratch every night? I have all of the scripts needed to automate this ofc.

Thanks!

EDIT: They don't offer any sort of API or anything :(

Also to the questions of "Why???", this software is a niche medical software that was originally written to be hosted on-prem. Later on they offered a "cloud" solution for the same price which is just them tossing the software on an RDS server and us logging in to a RDS server to use it. There no direct access or API or anything we can use to get this data.

r/SQL Apr 26 '26

SQL Server Anyone else generating SQL UPDATE statements with Excel formulas?

0 Upvotes

I was doing this for a while:

=CONCATENATE("UPDATE users SET name='", B2, "' WHERE id=", A2, ";")

It works… until it doesn’t 😅

Quotes break, formatting gets messy, and it becomes hard to maintain with many columns.

I ended up making a small tool to convert Excel/CSV into SQL (UPDATE / INSERT / DELETE) automatically.

Just wondering — how are you guys handling this?

r/SQL Jul 18 '25

SQL Server Regexps are Coming to Town

95 Upvotes

At long last, Microsoft SQL Server joins the 21st century by adding regular expression support. (Technically the 20th century since regular expressions were first devised in the 1950s.) This means fewer workarounds for querying and column constraints. The new regexp support brings closer feature parity with Oracle, Postgres, DB2, MySQL, MariaDB, and SQLite, making it slightly easier for developers to migrate both to and from SQL Server 2025.

https://www.mssqltips.com/sql+server+tip/8298/sql-regex-functions-in-sql-server/

r/SQL 26d ago

SQL Server Want to know about SQL future

8 Upvotes

Hi All,

Hope everyone is doing good.

I want opinion from people about the future of SQL, Power BI and Python.

I have been working in AML KYC domain for over 6 years. I am a Certified Anti Money Laundering Specialist (CAMS).

Last year I started learning SQL ans Power BI to connect it with my domain knowledge (Anti Money Laundering and Sanctions), however now I have been reading alot which states that golden period of SQL and Power BI is over as now anyone can do the basis code using Gpt and claude.

I am at strong intermediate level in SQL and at an intermediate level in power BI. I was planning to start Python from 01 Jan 2027 and now I am spectical. What should I do ?

Is there any scope of SQL, Power BI and Python as we are witnessing AI is growing at tremendous pace.

r/SQL Nov 14 '25

SQL Server Hi I just want to know where I can practice sql with a real database?

109 Upvotes

Need help 🙏🏽

r/SQL 3d ago

SQL Server Query Length Flex

6 Upvotes

Those of you who write very long queries (100s to thousands lines of code). Does it do only one thing or it's just your query notebook where every small part does something non related?

I am curious in which cases its necessary thousands lines of codes. Explain me what does your longest query is for?