SQL Study Notes Chapter7
SQL Study Notes Chapter7
1. Introduction to SQL
SQL stands for Structured Query Language. It is the standard language used to create, modify, retrieve, and
Commands like CREATE DATABASE and CREATE TABLE define structure. Data types include INT,
VARCHAR, DATE. Constraints: PRIMARY KEY, FOREIGN KEY, NOT NULL, DEFAULT, CHECK.
ALTER TABLE adds or removes columns. DROP TABLE deletes a table permanently.
INSERT INTO adds new data. UPDATE modifies existing data. DELETE removes rows.
SELECT retrieves data. WHERE filters data. Operators include AND, OR, NOT, BETWEEN, LIKE, IN, IS
NULL.
8. Aggregate Functions
9. Grouping Data
INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN combine rows from multiple tables.
COMMIT saves changes. ROLLBACK undoes changes. SAVEPOINT creates a restore point.
Practice SQL regularly. Use tools like SQL Fiddle, MySQL Workbench. Start with simple queries and build
up.