🧠 Welcome to SQL Brain!
Learn SQL. Build skills. Think like a Data Pro.
Here you'll find:
▸ SQL tips & queries
▸ SQL concepts made simple
▸ Interview questions
▸ SQL challenges
▸ Beginner → Advanced
Follow @SQLBrainDaily 🚀
Let's master SQL, one query at a time.
NULL in SQL 🧠
NULL = NULL → not true
NULL != 1 → not true
WHERE col = NULL → returns nothing
Use:
WHERE col IS NULL
WHERE col IS NOT NULL
NULL means "unknown", not zero or empty.
#SQL
Scary SQL moment 😬
UPDATE students
SET city = 'Delhi';
No WHERE clause = every row gets updated!
Safe habit: Run a SELECT with the same WHERE condition first. Verify the rows, then UPDATE.
One missing WHERE can change the whole table!
#SQL#SQLTips
SQL tip.
LIMIT 2 OFFSET 3 skips 3 rows, then returns 2.
Always add ORDER BY, otherwise the rows you get are not guaranteed.
SELECT * FROM Employees
ORDER BY EmployeeID
LIMIT 2 OFFSET 3;
#SQL
@Nikita26rai That semicolon after USERS is the culprit. DELETE runs on the whole table without a WHERE so it crawls. Move the ; to the end: DELETE FROM users WHERE id = 17623;
SQL recap of the week 🧠
→ COUNT(col) and AVG ignore NULLs
→ WHERE filters rows, HAVING filters groups
→ Join on keys, not on city-like columns
→ Check row counts before and after a JOIN
→ Use >= and < for date ranges, not BETWEEN
Which one got you? 👇
#SQL