User can access, update, delete, and store data or information in the database using database languages. The following are the databases languages in the database management system:
- Data Definition Language
- Data Manipulation Language
- Data Control Language
- Transaction Control Language
Data Definition Language (DDL)
Data Definition Language is used for defining the
structure or schema of the database. It is also used for creating tables, indexes,
applying constraints, etc. in the database.
The main purpose of DDL is to store the information of metadata like the number of schemas and tables, their names, indexes, constraints, columns in each table, etc. The result of Data Definition Language statements will be a set of tables which are stored in a special file called data directory or data dictionary.
This language is used by the conceptual schema to access and retrieve the records from/to the database respectively, where these records describe entities, relationship, and attributes.
There are following Data Definition Languages (DDL) Commands:
- Create: This command is used to create a new table or a new database.
- Alter: This command is used to alter or change the structure of the database table.
- Drop: This command is used to delete a table, index, or views from the database.
- Truncate: This command is used to delete the records or data from the table, but its structure remains as it is.
- Rename: This command is used to rename an object from the database.
- Comment: This command is used for adding comments to our table.
Data Manipulation Language (DML)
Data Manipulation Language is a language used to access or manipulate the data in the database. In simple words, this language is used to retrieve the data from the database, insert new data into the database, and delete the existing data from the database.
Data Manipulation Language is mainlyof two types:
- Procedural DML: This type of DML describes what data is to be accessed and how to get that data.
- Declarative DML or Non-procedural DML: This type of DML only describes what data is to be accessed without specifying how to get it.
There are following Data Manipulation Language (DML) Commands:
- Select: This command is used to retrieve or access the data from the database table.
- Insert: This command is used to insert the records into the table.
- Update: This command is used to change/update the existing data in a table.
- Delete: This command is used to delete one or all the existing records from the table.
Data Control Language
DCL is used to access the stored or saved data. It is mainly used for revoking and granting user access on a database. In the Oracle database, this language does not have the feature of rollback. It is a part of SQL.
There are following Data Control Language (DCL) Commands:
- Grant: This command allows user’s access privileges to the database.
- Revoke: This command removes the accessibility of users from the database objects.
Transaction Control Languages
Transaction Control language is a language which manages transactions within the database. It is used to execute the changes made by the data manipulation language (DML) statements.
There are following Transaction Control Language (TCL) Commands:
- Commit: This command is used to save the transactions in the database.
- Rollback: This command is used to restore the database to that state which was last committed.