Glossary

What Is SQL? Structured Query Language Explained

SQL (Structured Query Language) is the standard language for managing and querying relational databases. Initially developed at IBM in the 1970s and standardized by ANSI/ISO, SQL is used by virtually every relational database — PostgreSQL, MySQL, SQLite, SQL Server, Oracle — to create, read, update, and delete data.

Core SQL Commands

SELECT retrieves data: SELECT name, age FROM users WHERE age > 18 ORDER BY name LIMIT 10. INSERT adds rows: INSERT INTO users (name, age) VALUES ('Alice', 30). UPDATE modifies rows: UPDATE users SET age = 31 WHERE name = 'Alice'. DELETE removes rows: DELETE FROM users WHERE age < 0. CREATE TABLE defines a table schema; DROP TABLE deletes it.

JOINs Explained

JOINs combine rows from multiple tables. INNER JOIN returns rows where both tables have matching values. LEFT JOIN returns all rows from the left table and matched rows from the right (NULLs for no match). RIGHT JOIN is the mirror. FULL OUTER JOIN returns all rows from both tables. Example: SELECT u.name, o.total FROM users u INNER JOIN orders o ON u.id = o.user_id.

SQL Injection

SQL injection is the most common database vulnerability. Attackers inject SQL code into input fields to manipulate queries. Example: entering ' OR '1'='1 as a password can bypass authentication in systems that build queries with string concatenation. Prevention: always use parameterized queries or prepared statements — never concatenate user input directly into SQL strings.

SQL vs NoSQL

Relational databases (SQL) enforce schemas, support ACID transactions, and excel at complex queries with JOINs across normalized tables. NoSQL databases (MongoDB, DynamoDB, Redis) sacrifice some consistency for scalability, schema flexibility, or speed for specific access patterns. Most large applications use both: SQL for transactional data, NoSQL for caching, search, or document storage.