TYPES OF SQL COMMANDS
SQL (Structured Query Language) commands can be categorized into several types, including:
1. **Data Query Language (DQL) Commands:**
- `SELECT`: Retrieves data from one or more tables.
2. **Data Definition Language (DDL) Commands:**
- `CREATE TABLE`: Defines a new table's structure.
- `ALTER TABLE`: Modifies an existing table's structure.
- `DROP TABLE`: Deletes a table and its data.
- `CREATE INDEX`: Creates an index on a table to improve query performance.
3. **Data Manipulation Language (DML) Commands:**
- `INSERT`: Adds new records to a table.
- `UPDATE`: Modifies existing data in a table.
- `DELETE`: Removes records from a table.
4. **Data Control Language (DCL) Commands:**
- `GRANT`: Provides specific privileges to users or roles.
- `REVOKE`: Removes privileges from users or roles.
5. **Transaction Control Language (TCL) Commands:**
- `COMMIT`: Saves changes made during the current transaction.
- `ROLLBACK`: Undoes changes made during the current transaction.
- `SAVEPOINT`: Sets a point within a transaction to which you can later roll back.
6. **Session Control Commands:**
- `SET`: Modifies session-specific settings, like the date format or transaction isolation level.
These commands are the building blocks of SQL, allowing you to interact with and manage relational databases. The specific commands available may vary slightly between different database management systems (e.g., MySQL, PostgreSQL, SQL Server), but these categories generally apply to all SQL databases.
Comments
Post a Comment