An introduction to the SQL statements

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.

猜你喜欢

转载自agilestyle.iteye.com/blog/1550509