SQL (Structured Query Language) is a standard language for managing and manipulating relational databases. It is used for querying, updating, and managing data in databases. Common SQL commands include `SELECT`, `INSERT`, `UPDATE`, `DELETE`, `CREATE`, and `ALTER`.
A primary key is a unique identifier for records in a table. It ensures that no duplicate values exist in the column or combination of columns marked as the primary key. Each table can have only one primary key.
`GROUP BY` is used to group rows that share a common value in specified columns. It is typically used with aggregate functions like `COUNT()`, `SUM()`, `AVG()`, `MAX()`, and `MIN()` to return grouped results. For example: `SELECT department, COUNT(*) FROM employees GROUP BY department;`.
`INNER JOIN` returns only the rows that have matching values in both tables, while `OUTER JOIN` (including `LEFT JOIN` and `RIGHT JOIN`) returns all rows from one table and the matching rows from the other, filling in `NULL` where there are no matches.
A table is created using the `CREATE TABLE` statement. For example:
```sql
CREATE TABLE employees (
id INT PRIMARY KEY,
name VARCHAR(100),
age INT,
department VARCHAR(50)
);
```