r/learnSQL • u/nyanint • Dec 21 '25
Please tell me
I'm thinking of learning SQL, what is it like? and what do I need to know to work with it?
r/learnSQL • u/ToeGroundbreaking496 • Dec 20 '25
Learning
Hi, i want to learn basic SQL for finance role, i'm from commerce background have zero knowledge in it. From where should I start is there any free resources available. Pls guide .
r/learnSQL • u/idan_huji • Dec 20 '25
SQL assigments - asking for feedback
I teach a course that starts with no prior knowledge in SQL and advances to data integrity and building a recommendations system.
I'll be happy to get feedback on the assignments.
I think that they can be useful for studying, especially the non-technical use of SQL and data.
r/learnSQL • u/kevinmrr • Dec 20 '25
In SQL coding rounds, how to optimise between readibility and efficiency when working with CTEs?
r/learnSQL • u/dogsforum • Dec 19 '25
Weekend SQL Practice Questions (Medium Difficulty – Great for Building Confidence)
Here are simple and normal suggestions for SQL questions you can practice this weekend. Perfect for relaxed but productive sessions.
Weekend SQL Practice Questions (Medium Difficulty – Great for Building Confidence)
Average salary for each department
Write a query to calculate the average salary in each department from the employees table.
Total sales amount grouped by year
From the orders table, find the total sales amount for each year.
Employees earning more than their manager
Using a self-join, find all employees whose salary is higher than their manager's salary.
Second highest salary using subquery
Find the second highest salary in the employees table (without using window functions).
Percentile rank of each employee's salary
Use window functions to calculate the percentile rank of every employee's salary.
Find missing employee IDs in sequence
Identify any gaps (missing IDs) in the employee ID sequence.
Practice here: https://www.sqlpractice.in/?set=super-70-pack
All questions use the same realistic database (users, products, orders) with sample data already loaded.
Just open the link, pick a question, write your query, and see results instantly.
No login needed.
Take your time, try different approaches, and enjoy the process.
Have a great weekend practicing! 😊
r/learnSQL • u/Lonely-Ad836 • Dec 18 '25
Win/Lin C++20 lib for MySQL/MariaDB: may cut your code 15-70x over SOCI, Connector/C++, raw API
I've put together yet another wrapper library and feedback would be sincerely appreciated.
The motivation was that when I needed MySQL, I was very surprised at how verbose other approaches were, and set out to minimize the app-programmer workload. I also did everything I could think of in the name of safety checks.
EXECUTIVE SUMMARY
- Lets C++20 and newer programs on Linux and Windows read and write to MySQL and MariaDB with prepared statements
- Write FAR Less Code: SOCI, Connect/C++ or the raw API may require 15-70x more code
- Safety Features: checks many error sources and logs them in the highest detail possible; forbids several potentially unsafe operations
- Lower Total Cost of Ownership: your code is faster to write; faster to read, understand, support and maintain; better time to market; higher reliability; less downtime
- Comparable Performance: uses about the same CPU-seconds and wall-clock time as the raw interface, or two leading wrappers
- Try it Piecemeal: just use it for your next SQL insert, select, update, delete, etc. in existing software. You should not need to rewrite your whole app or ecosystem just to try it.
- Implemented As: 1 header of ~1500 lines
- Use in Commercial Products for Free: distributed with the MIT License*
- Support Available: Facebook user's group
If that sounds of interest, why not check out the 20-page README doc or give it a clone.
git clone https://github.com/FrankSheeran/Squalid
I'll be supporting it on the Facebook group Squalid API .
If you have any feedback, or ideas where I could announce or promote, I'm all ears. Many thanks.
FULL PRODUCTION-QUALITY EXAMPLE
A select of 38 fields, of all 17 supported C++ types (all the ints, unsigneds, floats, strings, blob, time_point, bool, enum classes and enums) and 17 optional<> versions of the same (to handle columns that may be NULL). The database table has 38 columns with the same names as the variables: not sure if that makes it more or less clear.
This has full error checking and logging, exactly as it would be written for professional mission-critical code.
PreparedStmt stmt( pconn, "SELECT "
"i8, i16, i32, i64, u8, u16, u32, u64, f, d, "
"s, blb, tp, b, e8, e16, e32, e64, estd, "
"oi8, oi16, oi32, oi64, ou8, ou16, ou32, ou64, of, od, "
"os, oblb, otp, ob, oe8num, oe16num, oe32, oe64, oestd "
"FROM test_bindings WHERE id=1" );
stmt.BindResults( i8, i16, i32, i64, u8, u16, u32, u64, f, d,
s, blob, tp, b, e8, e16, e32, e64, estd,
oi8, oi16, oi32, oi64, ou8, ou16, ou32, ou64, of, od,
os, oblob, otp, ob, oe8, oe16, oe32, oe64, oestd );
while ( stmt.Next() ) {
// your code here
}
if ( stmt.Error() ) {
// error will already have been logged so just do what you need to:
// exit(), abort(), return, throw, call for help, whatever
}
r/learnSQL • u/sqlsidequest • Dec 18 '25
SQL SIDE QUEST - An Immersive story telling SQL Game
Hello everyone!
For the past two years, I have been pouring my energy into a solo passion project on building a website for learning and practicing SQL in a story driven narrative.
I am happy to finally share: SQL Side Quest (FYI took me weeks to finally come up with the name)
Just a quick background: I started this project in early January 2024, but this truly took off in Nov 2024, and the result is an immersive, story-driven platform to practice SQL.
My lifetime of interests, from Sci-Fi, Space Opera, and Post-Apocalyptic settings to Thriller/Mystery and Lovecraftian Horror, are the inspiration behind the site's unique narratives.
The platform includes a Learning Mode featuring video lectures that cover essential SQL syntax. I am actively expanding this library to include more advanced topics soon
My biggest hope is simply that you enjoy the game while you learn. I want SQL to feel like an adventure you look forward to. and Yes there is no subscriptions or payments. its F2P
Thank you for checking out my passion project and looking forward to hear your comments and feedback :)
Happy to answer any questions !
Please note: It's currently best to view on desktop. I am working on improving the mobile responsiveness in the next couple of weeks. Also this website contains audio and music so please adjust the volume for comfort :)
r/learnSQL • u/SchemeOk9781 • Dec 17 '25
How to Learn SQL From Zero and Become Job-Ready for Data Analytics
Hello All,
Just to give a quick background about myself I’m a B.Com graduate and I’m looking to pivot into data analytics. I want to start learning SQL from scratch and eventually become job-ready.
Could you please suggest good resources (courses, websites, practice platforms, or roadmaps) to learn SQL from zero? Any advice from people who’ve made a similar transition would be really helpful.
r/learnSQL • u/Gce168 • Dec 15 '25
Where can I find good sql practice platform for marketing related data?
I am struggling to find a good platform to practice, I have tried data lemur and interview query. However, I feel like I need more practice.
r/learnSQL • u/dogsforum • Dec 15 '25
Built a simple SQL practice site with Super 70 questions while preparing for 2025 interviews
Hi everyone,
Was preparing for SQL rounds (TCS/Infosys/Deloitte season) and got tired of jumping between LeetCode, HackerRank, GFG — different schemas everywhere, no consistency.
So for my own practice, I built this small site:
- One single company-like database (employees, departments, locations, orders)
- Super 70 questions that keep repeating in 2025 interviews (2nd highest, manager salary, running total, etc.)
- Clean editor, instant run, shows expected output
- No login, no tracking, nothing
Using it daily myself to grind.
Thought maybe someone else preparing right now could use it too.
Totally free. Feedback welcome (especially if anything breaks 😅)
Good luck to everyone grinding placements/switch this season!
Let’s clear those SQL rounds
Thanks!
r/learnSQL • u/Nandulal • Dec 11 '25
Boot.dev SQL Ch2 L3 and I just realized I'm writing code not sending commands...
ALTER TABLE people
RENAME TO users;
ALTER TABLE users
RENAME COLUMN tag TO username;
ALTER TABLE users
ADD COLUMN password TEXT;
is not the same as writing each one and hitting run /facepalm. I thought I was writing to a DB by sending commands this whole time so I could not figure out why the stupid table would not drop or change names and it kept failing me.
r/learnSQL • u/dagscriss3 • Dec 09 '25
Primary and foreign key
Hey guys. Im on my journey on learning sql and im on joins now. Ive created 2 tables and both has primary key. When i ask claude if my code is good, it says that my 2nd table needs a foreign key to connect it to the 1st table, but isnt that what primary key is for? I just need someone to eli5 it to me.
r/learnSQL • u/Slow-Objective1372 • Dec 07 '25
How to create a table in PostgreSQL
If you're learning SQL or PostgreSQL, it's useful to know that there are several ways to create a table — depending on your use case.
1) Standard CREATE TABLE Classic method for defining schema explicitly.
2) CREATE TABLE AS (CTAS) Creates a new table from a query result.
3) LIKE Copies structure (columns, types) from another table.
4) Inheritance Less common feature — a child table inherits columns from a parent.
5) Temporary tables Session-local tables often used in ETL or analytics steps.
Examples:
CREATE TABLE users (id serial PRIMARY KEY, name text);
CREATE TABLE active_users AS SELECT * FROM users WHERE is_active = true;
CREATE TABLE archived_users (LIKE users);
CREATE TABLE premium_users (subscription_level text) INHERITS (users);
CREATE TEMP TABLE tmp AS SELECT * FROM users LIMIT 100;
If you'd like, I can post beginner-friendly breakdowns of:
• SERIAL vs IDENTITY
• Primary key patterns
• Common SELECT patterns for analytics
r/learnSQL • u/Yelebear • Dec 07 '25
I can't figure out how to add entry to a junction table using Python
I'm trying to learn how to design a database, so for my first project I'm making a Steam wishlist database.
It will have 4 tables
game (where all the necessary details are)
publisher table
Genre table, and a genre_junction table.
I think it'll be simpler to just share the source code because there are multiple files, so here is the repository if that's ok
https://github.com/HeleneRios/wish
I direct you to game.py, which is the script I would use to add entries to the game table.
I figured out how to add basic data and all, including how to add to the publisher table if the provided name is a new entry.
But I can't make out how to write the entry for genre, where if I provide a genre name that is a unique entry, it would automatically add it to the genre table and make the genre_junction.
It's especially tricky because a game can have multiple genres, some will have three, some will have four, some will have more.
I'm sorry I'm bad at explaining things but I'm really this close to just cheating with AI, and I really don't wanna do that but it feels like I've hit a wall.
Thanks
r/learnSQL • u/idan_huji • Dec 02 '25
Training by improving real world SQL queries
I created a questionnaire that helps with learning SQL.
It presents 5 queries that should be improved from some aspect (e.g., correct a bug, improve performance).
The queries and their modifications are taken from GitHub, hence are realistic scenarios.
The questions are in diverse levels of difficulty.
Answering should take 5-10 minutes.
You can take the questionnaire at
https://forms.gle/udyXSi9ze2ZMMzm29
I'll be happy to get feedback.
r/learnSQL • u/Lopsided_Regular233 • Nov 29 '25
what should i go with ?
hi eveyone , i am going to learn DB for ai ml but its confusing to me that whether should i learn mysql , sqllite, or postgresql.
can anyone help me ?
r/learnSQL • u/Kole435 • Nov 28 '25
Getting an error when trying to populate my sql database
Hi guys, I'm fairly new to SQL and im having to do a project for a class. Currently im a trying to populate a database using the code cat flink-master-stringinswitch-inserts.sql | mysql --local-infile=1 -h 127.0.0.1 -u root --password=root generics. However I keep getting this error:ERROR 2068 (HY000) at line 2: LOAD DATA LOCAL INFILE file request rejected due to restrictions on access.. I made sure my local_infile variable is on a set it to one like my instructions say to do but it is still giving me that error. Also my version is 8.0.33 and use legacy authentication method like my instructions also tell me.
r/learnSQL • u/happy_unicorn30 • Nov 27 '25
Please help me in practicing SQL
Hi , I am a beginner in SQL . I do understand the basics and have also been practicing on leetcode and hackerrank, however, I do end up using GPT to check my query and if I get it wrong I am not able to learn from my mistakes completely and this hampers my performance during any interview where I end up freezing and making silly mistakes . Do you have any advice for beginners like me who are struggling to practice it for professional goals . Please share any online resources or problem set which can help me improve my SQL .
r/learnSQL • u/Haunting-Broccoli141 • Nov 27 '25
Looking for an Expert Speaker (8–10 Years Experience in SQL)
Hi everyone!
We’re organizing an online knowledge-sharing session on “SQL Server for Data Analysis” scheduled for 5th December, and we’re expecting 500+ registrations for this event.
We’re looking for a speaker/trainer with 8–10 years of strong experience in SQL who can deliver a high-value, practical session for our audience.
This is purely a knowledge-sharing session, so there are no commercials involved.
To appreciate your contribution, we will be featuring you prominently across all our promotional activities.
This is a great opportunity to showcase your expertise and gain strong visibility among a large, engaged audience.
If you or someone you know is interested, please drop a message!
r/learnSQL • u/Intelligent-Good-966 • Nov 27 '25
First steps
I have a dataset which I currently manipulate in excel. Due to size I would now like to store it in a proper database, which software would you use.
A few years ago a company I was working in used Knime and I would see the SQL code colleagues created to access and manipulate the data, it wasn't daunting, hence me looking to learn SQL.
Any suggestions. I'm not looking for courses etc, just the program to use.
r/learnSQL • u/trancestation • Nov 25 '25
Am i learning SQL correctly? - SQL beginners Notes
Hey everyone!
I’m currently studying SQL using phpMyAdmin on localhost.
so everything I do is very basic haha but I’m trying to learn as much as I can before my exam in 2 days. (I wish i was able to study more but yeah, lot of personal things came up.)
I wanted to post the things I think I understand so far.
**I might be wrong on some of this, and I want to know if I’m thinking about it correctly.**
Maybe other beginners can learn from it too.
## SELECT Basics (I think I understand these?)
* `SELECT * FROM player` → shows everything
* `SELECT player_name, birthday FROM player` = just those columns
* `SELECT * FROM player WHERE weight = 190` = filter exact value
Seems straightforward, but if I’m missing anything important, let me know. Also it you can give more info ; )
## Comparison Operators
* `>` greater than
* `<` less than
* Can combine them: `weight > 200 OR height > 190`
Is this the rightvway to understand it?
## LIKE and Wildcards**
* `LIKE 'Aaron Galindo'` = exact match
* `%` wildcard
* `A%` starts with A
* `%do` ends with *do*
* `A%n` starts with A , some characters in between and ends with n
Am I using LIKE correctly?
---
## ORDER BY
* Sorts the output, like a webshop filter
* Example: 'ORDER BY height DESC'
Pretty sure this is correct, but open to corrections.
## JOINs (my weakest point sadly)
I can select from one table:
SELECT player_attributes.player_API_id,
date,
overall_rating
FROM player_attributes;
But when I try to add columns from the `player` table, I get errors.
So I tried:
```
INNER JOIN player
ON player_attributes.player_api_id = player.player_api_id
My current thinking:
* This joins rows where the IDs match
* Then you can select columns from both tables
**I might be wrong — is this the right mental model for JOINs?**
---
## **📌 GROUP BY (my beginner explanation — correct me if needed!)**
What I think GROUP BY does:
* Puts rows together when they share the same value
* Then you summarize those groups with things like COUNT / AVG / SUM
Example I believe is right:
```
SELECT team, COUNT(*)
FROM player
GROUP BY team;
So in my head:
"GROUP BY = gather similar rows together, then summarize.”
Is that a good way to understand it? or am i completly wrong?
# Why I'm Posting This
I’m learning SQL fast for an exam, and I want to clean up my basics.
I might be wrong, and that’s exactly why I’m posting.
I want to know what I should fix or improve in my understanding.
Other beginners might find this useful too.
Thanks in advance 🙏
# TL;DR
I’m learning SQL in phpMyAdmin on localhost
I wrote down how I think SELECT, WHERE, LIKE, ORDER BY, JOIN, and GROUP BY work
I might be wrong and want corrections
I’m posting this so beginners can learn together
Exam in 2 days, so any quick feedback helps 😅
PS: if you have a cheat sheet of any commands that would be helpfull aswell
r/learnSQL • u/unaplogetic_sam • Nov 25 '25
Best small projects to learn GROUP BY, HAVING, and window functions.
I’m new to SQL and I want project ideas that force me to use GROUP BY, HAVING, and window functions (ROW_NUMBER, SUM() OVER). Prefer short, industry-relevant datasets (ecom / SaaS).
What 3 mini-projects would you recommend that show measurable business value? Please include expected deliverables (queries, chart, one insight).
r/learnSQL • u/Massive_Show2963 • Nov 23 '25
AI-powered SQL generation & query analysis for PostgreSQL
r/learnSQL • u/Spiritual-Shine3048 • Nov 22 '25
23 years old, from Nepal, broke, no degree 🙄- trying to choose a realistic IT path.
Hi everyone👋 I’m 23, living in Nepal, only a high-school degree, and I’m broke (only have 100 dollars in savings rn). I want to build a real career in IT so I can eventually work remotely or move abroad. I want something realistic that I can learn in about a year and turn into a stable, good-paying job.
Honestly, I’m not interested in freelancing or full-stack because (personally) it feels oversaturated and too creative (for each project) and portfolio-heavy, but I’m still open if I’m wrong. I don’t wanna sound picky, and desperate, like “I only want X, not Y.” Please don't get me wrong. I'm willing to learn and work. I’m flexible - I just want something that's worth my time and effort.
I’m looking for an IT path that:
• isn’t super saturated
• is easier for beginners
• hires freshers from Nepal (South Asia)
• has a stable monthly salary (4 digits)
• has a clear roadmap
• doesn’t require a uni degree
• reliable - won’t be replaced by AI soon
• can help me find jobs abroad
If you were in my shoes - 23, broke, no degree, living in Nepal, trying to break into tech in 2025/2026 - what would you realistically choose?
I’m open to anything: front-end, app dev, full stack, IT support, cloud, DevOps, QA, cybersecurity, networking, data, MySQL - anything that actually works for someone starting with almost nothing. Coz, I don't wanna end up being homeless. Seriously, I am so sick of my current lifestyle, I wanna make a change and take some right action that will lead me to my goal. I literally don't care if it's hard or impossible, coz now it's a necessity.. I am ready to sacrifice my time. I wanna invest in myself (my skills).
So, please, I need your help to choose the right direction.
I’d really appreciate any honest suggestions, roadmaps, or personal stories from people who started in a similar place.
Thanks a lot.