SQL
SQL
Below is a comprehensive list of SQL syntax categories and their common commands. Note that this is
not an exhaustive list, but it covers the most widely used SQL syntax.
```sql
column1 datatype,
```sql
```
```sql
DROP DATABASE database_name;
```
- **TRUNCATE**: Remove all rows from a table without logging individual row deletions.
```sql
```
---
```sql
```
```sql
```
```sql
```
- **DELETE**: Remove rows from a table.
```sql
```
---
DQL is primarily used for querying data. The main command is:
```sql
---
```sql
```
```sql
---
```sql
COMMIT;
```
```sql
ROLLBACK;
```
- **SAVEPOINT**: Set a point within a transaction to which you can roll back.
```sql
SAVEPOINT savepoint_name;
```
```sql
```
---
### **6. Constraints**
- **PRIMARY KEY**: A combination of NOT NULL and UNIQUE. Uniquely identifies each row.
Example:
```sql
);
```
---
```sql
SELECT columns FROM table1
```
- **LEFT JOIN (OUTER JOIN)**: Returns all rows from the left table and matching rows from the right
table.
```sql
```
- **RIGHT JOIN (OUTER JOIN)**: Returns all rows from the right table and matching rows from the left
table.
```sql
```
- **FULL JOIN (OUTER JOIN)**: Returns rows when there is a match in either table.
```sql
```
```sql
```
---
- **Example**:
```sql
```
---
```sql
```
```sql
```
```sql
```sql
```
```sql
```
---
### **10. String Functions**
```sql
```
```sql
```
```sql
SELECT CONCAT(column1, column2) FROM table_name;
```
```sql
```
---
SELECT NOW();
```
```sql
SELECT CURDATE();
```
```sql
```
---
### **12. Other Clauses**
```sql
```
```sql
SELECT column_name, COUNT(*) FROM table_name GROUP BY column_name HAVING COUNT(*) > 1;
```
```sql
SELECT column_name FROM table_name ORDER BY column_name ASC;
```
```sql
```
---
This is a high-level overview of SQL syntax. Depending on the database system (e.g., MySQL, PostgreSQL,
SQL Server, Oracle), there may be additional features or slight variations in syntax.