Saturday , 24 July 2021
Breaking News

How do SQL Commands work in DBMS?

Spread the love

How do SQL Commands work in DBMS?

How do SQL Commands work in DBMS? In this article, we will discuss how do SQL commands work in DBMS? Here we will learn about different types of SQL Commands

SQL stands for Structured Query Language. SQL commands are the instructions used to interact or communicate with a database to perform tasks, functions, and queries with data. This language is also called Database languages are used to read, update and store data in a database.

Below is a diagram where we can understand about the concept of How do SQL Commands work in DBMS? .

SQL Commands

Here are some types of SQL Commands from where we can understand how sql commands works in DBMS.

How do SQL Commands work in DBMS? There are four main types of SQL Language.

  1. Data Definiaton Language (DDL).
  2. Data Manupulaion Language (DML).
  3. Data Control Languag. ( DCL).
  4. Transaction Control Language (TCL).

Data Definition Language.

It is used for creating tables, schema, indexes, constraints etc. in database. DDL is used for specifying the database schema.

How does DBMS Works?

Create Command.

create the database instance – CREATE

Syntax.

CREATE TABLE table_name(column1 datatype,column2 datatype,…..);

2. Alter Command

This command is used to alter the structure of database

Syantax

How do SQL Commands work in DBMS?

ALTER TABLE table_name ADD column_name datatype;

3. Drop Command

This command is used to drop database instances .

Syantax

Drop database Database_Name;

4. Truncate Command.

Truncate command is used to delete tables in database instances.

Syntax

Truncate TABLE Table_Name;

5. Rename Command.

Rename command is used rename database or table name instances.

Syantax.

Rename Table CURRENT TABLE NAME to NEW TABLE NAME;

6. Comment Command.

This command is used to give comments. — comments

Data Manipulation Language (DML)

DML is used for accessing and manipulating data in a database.

Insert Command.

Insert Command is used to insert records into the tables.

Syantax.

INSERT INTO Table_Name(Col1, Col2,Col3…….)values(value1,value2,value3……..);

2, Select Command.

Select command is used read records from tables.

Syantax.

Select Col1,Col2,Col3 …….. from table_name);

3.Update Command.

Update Command is used to update record into the tables.

Syntax.

Update table_name SET col1=val1,col2=val2…….WHERE condition);

4. Delete Command.

Delete command is used to delete records from table;

Delete From Talbe_name Where condition;

Data Control Language (DCL)

It is used to control access to data stored in a database (Authorization).

1. Grant Command.

Grant Command is used to grant access to user.

Syntax

Grant Privilage_Name ON Object_Name TO( User_Name | Public | Role } [ With Grant Option);

2. Revoke Command.

This command is used to revoke access from user.

Syantax.

Revoke Privilage_Name ON Object_Name FROM { User_Name | Public | Role };

Transaction Control Language(TCL)

Transaction Control Language commands are used to manage transactions in the database

COMMIT Command.

This command is used to persist the changes done by DML Commands in database.

Syntax

COMMINT;

2. ROLLBACK.

This command is used rollback the changes made to the database.

Syantax.

ROLLBACK;

Leave a Reply

Your email address will not be published. Required fields are marked *

Adnan Online Class