Tag

#SQL

Every article tagged SQL, in one place.

  • 15 articles
  • 16 min of reading
  • 27 Sep, 2026 last updated

Showing 15 articles

MySQLNew 1 min read

Modern MySQL Features Every Developer Should Use

If your MySQL habits date from version 5.x, you're missing features that make queries simpler and schema changes safer. Common table expressions WITH monthly AS ( SELECT DATE_FORMAT(created_at, '%Y-%m') AS month, SUM(total) AS revenue FROM orders GROUP BY mont...

27 Sep, 2026 Author 569 132
Read article
SQLNew 1 min read

SQL Interview Question: WHERE vs HAVING

Short answer: WHERE filters individual rows before grouping. HAVING filters groups after GROUP BY , so it can use aggregate functions like COUNT and SUM . -- Customers who placed more than 5 paid orders in 2026 SELECT customer_id, COUNT(*) AS paid_orders, SUM(...

23 Sep, 2026 Author 835 64
Read article
OWASP Top 10 2 min read

SQL Injection: How It Works and How to Prevent It

SQL injection happens when user input is pasted into a SQL string, letting an attacker change the query itself. It's old, well understood and still found in production code. The vulnerability // email comes from a login form const sql = `SELECT * FROM users WH...

20 Aug, 2026 Author 1.3K 48
Read article
SQL 1 min read

SQL Interview Question: UNION vs UNION ALL

Short answer: both stack the results of two queries. UNION removes duplicate rows; UNION ALL keeps every row. Because removing duplicates needs a sort or hash step, UNION ALL is faster. -- Emails from two sources SELECT email FROM newsletter_subscribers UNION...

06 Jun, 2026 Author 1K 73
Read article
SQL 1 min read

SQL Interview Question: DELETE vs TRUNCATE vs DROP

Short answer: DELETE removes selected rows, TRUNCATE quickly removes all rows but keeps the table, and DROP removes the table itself, including its structure. DELETE FROM sessions WHERE expires_at < NOW(); -- some rows TRUNCATE TABLE import_staging; -- all row...

19 May, 2026 Author 170 87
Read article
PostgreSQL 1 min read

SQL Window Functions and CTEs in PostgreSQL

Window functions compute values across related rows without collapsing them like GROUP BY does. Combined with CTEs, they replace a lot of application-side data crunching. Window function basics SELECT customer_id, id AS order_id, total_paise, ROW_NUMBER() OVER...

06 May, 2026 Author 1.24K 75
Read article