Understand SQL Statement in SQL Server


Introduction

SQL-Structure Query Language which help to query,manipulate other operation in the database.SQL Server released in the year 1989 with version -SQL Server-1.0.Current version is Sql server-2017 released on 2017.

Lets Get Started

SQL Statements in sql server are broadly divided into 4 types. They are as below.


  • DDL (Data Defination Language)
  • DML (Data Manipulation Language)
  • DCL (Data Control Language)
  • TCS (Transaction Control Statement)

 Lets discuss below category wise.

 DDL-As name suggest it is used to define database structure. The database operation comes under this as below.

DDL Statement Description
CREATE Used to create the Database or table
ALTER It used to modify the database structure.
DROP Delete the table or Database
TRUNCATE Used to delete all the records and associated table pace
RENAME It rename the Database or Table

DML- As name suggest it used to manipulate data(Can not play with data structure) using the following statement.


DML Statement Description
SELECT It used to Select the records from single table,multiple table,function and view.
UPDATE It used to update new data to the table.
INSERT Used to insert data to the table
DELETE Used to delete complete table or specific row from the table
LOCK TABLE table used to lock one or more table in a specific mode.
MERGE Used to merge two table data in a single pass


DCL- As name suggest it used to control the data by applying special permission to data.


DCL Statement Description
GRANT It give previlage to use the database resource.
REVOKE It take back the permission given to the specific resource

TCS-As name suggest it helps us to provide the feature which help to permanent save as well as revert back the data.
TCS Description
COMMIT It used to commit the data when it get successful. After that you can not rollback.
ROLLBACK Restore original data since the last commit takes place.
SAVEPOINT Created for later use ROLLBACK the new changes.

We understood the types of statements available in sql server.
DDL,DML are most commonly used statement in Sql server.



Thanks....................
Share:

No comments:

Post a Comment

Contact for Azure Training

Name

Email *

Message *

Subscribe YouTube

Total Pageviews

Popular Posts

Labels

Recent Posts