Google News
logo
Management Information System (MIS) - Interview Questions
What are the three main types of statements in SQL?
In SQL (Structured Query Language), there are three main types of statements:

Data Definition Language (DDL) Statements :

* DDL statements are used to define, modify, and delete database objects such as tables, views, indexes, and schemas.
* Common DDL statements include:
* CREATE : Used to create new database objects, such as tables, indexes, views, or schemas.
* ALTER : Used to modify the structure of existing database objects, such as adding, modifying, or dropping columns in a table.
* DROP : Used to delete database objects, such as tables, views, indexes, or schemas.
* TRUNCATE : Used to delete all data from a table, but the table structure remains intact.
* COMMENT : Used to add comments or descriptions to database objects.


Data Manipulation Language (DML) Statements :
* DML statements are used to manipulate data stored in the database. They include operations such as querying, inserting, updating, and deleting data.
* Common DML statements include:
* SELECT : Used to retrieve data from one or more tables in the database.
* INSERT : Used to add new rows of data into a table.
* UPDATE : Used to modify existing data in a table.
* DELETE : Used to remove rows of data from a table.
* MERGE : Used to perform insert, update, or delete operations based on specified conditions.


Data Control Language (DCL) Statements :
* DCL statements are used to control access to data stored in the database. They include operations such as granting and revoking privileges to users and roles.
* Common DCL statements include :
* GRANT : Used to grant specific privileges (such as SELECT, INSERT, UPDATE, DELETE) on database objects to users or roles.
* REVOKE : Used to revoke previously granted privileges from users or roles.
 
These three types of SQL statements provide the foundation for interacting with relational databases, allowing users to define, manipulate, and control data and database objects effectively.
Advertisement