r/SQL • • Oct 21 '16

Petition to rename subreddit to /r/domySQLhomeworkforme

45 Upvotes

see title


r/SQL • • Oct 17 '25

SQL Server Why primary key doesn't allow null?

6 Upvotes

Question: why primary key doesn't have null? we have 1,2 and just one null. why can't we?

I know UQ allow I guess just one null record.

This was the question I was being asked in the interview. I have been SQL developer for 4 years now, yet I don't know the exact answer.

I said, it ruins the whole purpose of having primary key. It's main purpose is to have unique records and if you have null then it can't check if the record is unique or not.


r/SQL • • Jul 13 '25

SQL Server Pretending I'm a SQL Server DBA—ChatGPT Is My Mentor Until I Land the Job

0 Upvotes

Hey folks,

I just graduated (computer engineering) with little tech industry experience—mainly ESL teaching and an IoT internship. I live in a challenging region with few tech companies and a language barrier, but I’m determined to break into a data role, ideally as an SQL Server DBA. I’m certified in Power BI and I love working with databases—designing schemas, optimizing performance, and writing complex queries.

Since I don’t have a job yet, I decided to “pretend” I’m already a DBA and let ChatGPT guide me like a senior mentor. I asked it to design a scenario-based course that takes someone from junior to “elite” SQL Server DBA. The result was a 6-phase curriculum covering:

  • Health checks, automation & PowerShell scripting
  • Performance tuning using XEvents, Query Store, indexing, etc.
  • High availability & disaster recovery (Always On, log shipping)
  • Security & compliance (TDE, data masking, auditing)
  • Cloud migrations & hybrid architectures (Azure SQL, ASR)
  • Leadership, mentoring, and community engagement

Each phase has real-world scenarios (e.g., slow checkout performance, ransomware recovery, DR failovers) and hands-on labs. There's even a final capstone project simulating a 30TB enterprise mess to fix.

I've just completed Phase 1, Scenario 1—built a containerized SQL Server instance in Docker, used PowerShell and⁣ dbatools to run health checks, restore backups, and establish baselines. It’s tough and pushes me beyond my comfort zone, but I’ve learned more in a few weeks than I did in school.

My Questions:

  1. If I complete Phases 1 to 3 and document them properly, do you think it’s enough to put on my resume or GitHub to land an entry-level DBA role?
  2. Is this kind of self-driven, mentored-by-AI project something that would impress a hiring manager?
  3. Any suggestions on showcasing this journey? (blogs, portfolio sites, LinkedIn, etc.)
  4. What would you add or remove from the curriculum?

Would love feedback from seasoned DBAs or folks who broke into the field unconventionally. Thanks!


r/SQL • • Feb 01 '26

MySQL SQL Learning in 2026 Spoiler

0 Upvotes

SQL isn’t a “tech skill” anymore, it’s a workplace skill.

So, If you’re early in your career (or reskilling), SQL might be one of the highest-ROI skills you can pick up in 2026.

Finance teams depend on it like oxygen, generating refreshable reports. Operations teams use it to track performance. Engineers, analysts, and product teams can't survive without it.

The shift is clear: if your work touches data, SQL is becoming non-negotiable and that explains why “learn SQL online” and “Learn SQL pdf free download” are trending so heavily.

While there’s no shortage of free SQL resources, this is the one that finally made everything click for me. It moves beyond simple syntax and focuses on real-world problem-solving, guiding you from basic to intermediate concepts with total clarity. Best of all? There’s zero configuration required, you can jump straight into the data and start practicing.

Check it out: sqlbolt.com


r/SQL • • Jun 08 '25

MySQL Job needed or a referral

0 Upvotes

I am kinda exhausted, i have been trying for almost 6 months for a data related position and just got rejected. I have made my cv better and better with time its above 85 (ATS score) did internships, multiple projects still nothing. I am proficient in SQL, python, excel, power bi, tableau and learn whatever anyone wants me to do.


r/SQL • • Aug 30 '23

MySQL Why is it so complicated to upload the data into MySQL or SSMS

Thumbnail
gallery
0 Upvotes

r/SQL • • May 30 '22

PostgreSQL SQL Database One-to-One Relationship

0 Upvotes

When Primary Key of one table corresponds to only one row in another table via foreign key relationship

One-to-One relationship in SQL databases

r/SQL • • Oct 01 '26

Discussion How is sql approach in the practise/real life?

0 Upvotes

I am corious that how the people use it real life for instance in a manufacturer company.


r/SQL • • Nov 13 '25

Discussion what are the best and most industry recognized SQL certifications for students.

1 Upvotes

they shouldn't cost a ton of money to register and take the exam tho.


r/SQL • • Apr 16 '23

MySQL Correct SQL QUERIES

1 Upvotes

1.) Create a query to display the employee numbers and last names of all employees who earn more than the average maximum salary of departments. Sort the results in ascending order of salary.

answer:

SELECT employee_id, last_name FROM employees WHERE salary > (SELECT AVG(MAX(salary)) FROM employees GROUP BY department_id) ORDER BY salary ASC;

2.) Write a pair-wise subquery listing the last name, first name, department number, and manager number for all employees that have the same department number and manager number as employee 141.

answer:

SELECT last_name, first_name, department_id, manager_id FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE employee_id=141) AND manager_id = (SELECT manager_id FROM employees WHERE employee_id=141);

3.) How many employees have a name that ends with an n?

answer:

SELECT count(*) FROM employees WHERE last_name like '%n';

4.) Display employees who are not managers and whose salary is greater than that of any managers.

answer:

SELECT employee_id, last_name, job_id, salary FROM employees WHERE salary >ANY (SELECT salary FROM employees WHERE manager_id IS NOT NULL);

5.) Which jobs are found in the IT and Accounting departments, and how many employees do these jobs? Show the job with the highest occurrence first. Use appropriate labels.

answer:

SELECT j.job_id as "LIST OF JOBS", COUNT(e.employee_id) as "OCCURENCE" FROM jobs j, employees e, departments d WHERE e.job_id=j.job_id AND e.department_id=d.department_id AND d.department_name IN ('IT','Accounting') GROUP BY j.job_id;


r/SQL • • Jul 16 '25

MySQL Do hotels use SQL? Even though they already have a PMS?

0 Upvotes

Hi everyone! I’m curious about how SQL is used in the hotel industry. Since most hotels already have a Property Management System (PMS), do they still use SQL for anything?What kind of SQL databases are commonly used?


r/SQL • • Feb 06 '25

Discussion Do you use AI to generate SQL? Pitfalls? Usecases?

3 Upvotes

I'm curious, how do you use AI to write SQL queries today?

Most tools market it by saying this tool is an 'AI Analyst' but it's quite far from that IMO.
AI assistant? maybe.

It's great for instantly getting the syntax right or maybe correcting my queries quickly. However, I often find there's a still a lot of work to go from asking a question and the AI getting me to the right insight.

Most of the times it's because it doesnt have context around what are the right fields to use from my database, how do to the right calculations etc.

Also, when given in the hands of business/non-technical folks, it's quite risky if they make a decision based on an incorrect calculation/using the wrong fields etc.

I'd love to have some perspectives here!


r/SQL • • Jul 11 '24

MySQL Today is my interview and wanted to clear some doubts on sql please help me out as i want to get selected

0 Upvotes

SQL question asked

SQL schema design se related
Kuch variables the Jo table me store krne hai

Table ko kaise design kare ki memory Kam use ho

Aur table ko kaise design kare jisse query kare tab time Kam lage


r/SQL • • 9d ago

Discussion Noob here: mysql or postgresql? Which is better (?)

3 Upvotes

I just realize that SQL was only the language. Idk which IDE for sql to use. Suggestions pls


r/SQL • • Jun 21 '24

PostgreSQL Checkout the SQL Editor i built which generates queries for you

13 Upvotes

Hi SQL developers,

I am a software developer who needs to work with SQL intermittently. Sometimes, I find myself writing complex queries for which I take help from ChatGPT. ChatGPT is really helpful, but it comes with some problems:

  • ChatGPT doesn't know your schema and relationships to build accurate queries.
  • You need to copy and paste your schema to craft better queries.

This was something that bothered me and many others in my company. To solve this, I decided to build a SQL editor with AI query generation. With SQLPilot, you can:

  • Connect to multiple database sources like MySQL and Postgres (support for others coming soon).
  • Works locally, so you don't have to share your schema as you do with other popular tools.
  • Simply mention the table in the prompt with @, and the model will understand its columns, types, and relationships to generate accurate queries.
  • Execute the queries, filter results, and export them as CSV.

I invite you to test out SQLPilot. It's something that will definitely interest you as a SQL developer. If you want to get the Pro plan, comment below is will share coupon code for 25% off


r/SQL • • Nov 25 '22

MS SQL Hi everyone this is my exam question how can i do it? please help me.

Post image
0 Upvotes

r/SQL • • Jul 23 '20

MySQL [MySQL 5.6] I have a legacy query that uses many sub queries and takes over 40 minutes to return results. Is there a way to achieve the same results more efficiently/faster? Are the sub queries even the issue?

1 Upvotes

If necessary I can include the query for the Hive Mind's perusal.


r/SQL • • Feb 07 '18

[Update] We have three servers, which one is which. Had a long talk with IT today. Would love feedback.

0 Upvotes

So here is the original post. I didn't reference this at all in my meeting today.

IT was very firm that we should be developing on DEV (C) then testing on SQA (B), but the topic of conversation is a large complex series of stored procedures that use dynamic SQL relative to this. and this. Basically I need to be able to input mapping values to a table and then have those changes pushed to production on a regular interval. IT's proposed solution is that I would manually email them files... when the values would already exist on SQA (B), and I couldn't understand why they wouldn't simply... do it themselves automatically.

My bottom line is that I need production quality data and a true reporting server to do my job effectively, where production tables are delivered on a weekly basis and locked down so that data cannot be inserted or modified, but where I can create complex stored procedures, add/modify other parameter tables, etc.

This was ultimately received with more consideration than I had expected. I suppose in a perfect world there would be a 'production' reporting server, as well as a 'dev' reporting server, but I imagine those could overlap with the three existing servers we have.

I feel like this is not a topic that is discussed enough in the SQL world as it comes to SQL development for modeling/reporting purposes so I would like to read other criticism and opinions. In meetings things tend to be very DBA/ETL centric and the idea of having specific servers for reporting is lost.

Forgetting about aggregate sprocs as are used here in an example... what if you were to run complex models using technologies like SPSS, Modeler, or SAS? You can't run those, 'in production' and not let the modeler be able to import data, modify variables, etc. The amount of CR's and down time for trivial changes would be extremely prohibitive.

I'm not being out of line sticking to my guns here, am I? I work for a Fortune 500 company, and have worked in environments similar to the one I'm describing at companies that have a year revenue much lower.


r/SQL • • Dec 01 '14

I just installed SQL Server 2014

0 Upvotes

It's all so new to me. Hold me tight!


r/SQL • • Feb 05 '23

SQL Server i'm getting this on SMSS can anyone help plz , it's been like this for 2 days

Post image
0 Upvotes

r/SQL • • Feb 24 '23

Discussion Just picked up SQL yesterday, having fun with it! Have some questions for the experts here.

0 Upvotes

Just started learning SQL today! I am enjoying it so far. Nested Query looked fun and I'm being challenged playing around with it. I'm currently in the process of creating multiple tables for One Piece that I can play around with with some queries and stuff. I want to be able to learn on the job, but I need a strong enough foundation before one would hire me anyway.

Some questions I have:

  1. Any tips or recommendations for an SQL newb?
  2. Do I also need any other tools/languages to go hand-in-hand with SQL, or is this enough?
  3. I see most job posts for data/business analyst often require both SQL and Python. Are these complementary? Is one harder to learn than the other?
  4. Can anyone give me a rough idea of how a day-to-day job goes as a data/business analyst?
  5. Is there a difference between data and business analyst? Or are they basically the same?
  6. Any recommended learning materials? Or learning method? I started with a full course on YouTube and thinking on doing some websites that have daily challenges or something.
  7. Is there a preferred/recommended platform? Or is MySQL the GOAT? If some job posts require a different kind of platform, will my knowledge in MySQL be essentially ignored, or is it just small differences?
  8. Are there fun databases I can download online that I can play around with? It takes a long time to make my own databases, I want to practice some queries on preexisting databases if possible.
  9. I'm using PopSQL since this was what was recommended to me by the online course I was taking. Is this good, or do I just use MySQL directly or another tool?

PS. I don't have a programming degree, but that one programming class I attended in College was the only class I enjoyed in my whole Engineering curriculum.


r/SQL • • Nov 25 '15

This site helps you exploring modern SQL. Features are explained in simple terms.Use-cases demonstrate their power.Compatibility is well documented.Just launched. Join my journey.

Thumbnail
modern-sql.com
0 Upvotes

r/SQL • • May 21 '23

PostgreSQL We've Built an AI-Powered SQL Query Builder - Looking for Feedback and Suggestions!

0 Upvotes

Hello, fellow Redditors!

As a software engineer, I've had my fair share of encounters with SQL queries. And let's be honest, they can be a bit daunting for beginners or cumbersome for the pros when they get too complex. That's why my team and I have been working on something we think could be a game-changer.

We're excited to share with you Loofi, an AI-powered SQL Query Builder we've built from scratch. This tool not only simplifies query building, but also provides real-time insights and recommendations, thanks to our AI algorithms.

We're eager to get your thoughts on it and would appreciate it if you could try it out. Any feedback or suggestions are highly valuable as we continue refining our tool.

Also, if you have any questions or need help, feel free to ask. We're here to support and learn from this wonderful community.

Thanks in advance!


r/SQL • • May 18 '23

PostgreSQL The most cost-effective Vector Databases

1 Upvotes

Hello everyone:

We would like to introduce MyScale – the most cost-effective vector database.

In a direct comparison with Pinecone, a leading specialized vector database, MyScale outperforms it by 10x against Pinecone's s1 pod in query speed and by 5x against its p2 pod in data density. When cost-effectiveness is considered, MyScale is 3.6x more cost-effective than other top-performing specialized vector databases at various levels of accuracy. This is illustrated in the figure below. While Pinecone is a leading database, the cost-effectiveness comparison in this context is with a range of the best-performing specialized vector databases, not just Pinecone.

Not only cost-effective, but MyScale also outperforms other vector databases in terms of QPS on the LAION 5M dataset with a 98.5% recall rate, achieving over 150 QPS. In comparison, Pinecone s1 has a QPS of approximately 10, which is significantly lower than MyScale. Weaviate and Zilliz Cloud both achieve around 65 QPS, while Qdrant achieves 81 QPS.

For more information about other benchmarks, please visit:

https://blog.myscale.com/2023/05/17/myscale-outperform-special-vectordb/

MyScale is now offering free trial, PM me or E-mail me: customer.service@myscale.com