The SQL statements can be divided into two categories: the data manipulation language(DML) that let you work with the data in the database and the data definition language(DDL) that lets you work with the objects in the database.
SQL programmers typically work with the DML statements, while database adminstrators(DBAs) use the DDL statements.
The statements that work with the data in a database are called the data manipulation language(DML).
SQL statements used to work with data(DML)
| Statements | Description |
| SELECT | Retrieve data from one or more tables. |
| INSERT | Adds new rows to a table. |
| UPDATE | Changes existing rows in a table. |
| DELETE | Deletes existing rows from a table. |
The statements that work with the objects in a database are called the data definition language(DDL). On large systems, these statements are used exclusively by database adminstrators, or DBAs. It's the DBA's job to maintain existing databases, tune them for faster performance, and create new databases. On smaller systems, though, the SQL programmer may fill the role of the DBA.
SQL statements used to work with database objects(DDL)
| Statement | Description |
| CREATE USER | Creates a new user for a database. |
| CREATE TABLE | Creates a new table in a database. |
| CREATE SEQUENCE | Creates a new sequence that automatically generates numbers. |
| CREATE INDEX | Creates a new index for a table. |
| ALTER USER | Changes the definition of an existing user. |
| ALTER TABLE | Changes the definition of an existing table. |
| ALTER SEQUENCE | Changes the definition of an existing sequence. |
| ALTER INDEX | Changes the structure of an existing index. |
| DROP USER | Deletes an existing user. |
| DROP TABLE | Deletes an existing table. |
| DROP SEQUENCE | Deletes an existing sequence. |
| DROP INDEX | Deletes an existing index. |
| GRANT | Grants privileges to a user. |
| REVOKE | Revokes privileges from a user. |
本文介绍了SQL语言中的两大核心部分:数据操纵语言(DML)和数据定义语言(DDL)。DML包括SELECT、INSERT、UPDATE及DELETE等用于操作数据库中数据的语句;DDL则涵盖了CREATE USER、CREATE TABLE等用于管理数据库对象的语句。
1380

被折叠的 条评论
为什么被折叠?



