SQL- Overview and Types of commands

l0l0l0l - May 23 '19 - - Dev Community

SQL is the language which is used to store data, retrieve the same, and manipulate data in a Relational Database System.

SQL commands are guidelines that are utilized to cooperate with the database like Sql Server, MySql, Oracle and so on. SQL directions are mindful to create and to do all the control on the database. These are likewise mindful to give/take out access rights on a specific database.

The following are the types of SQL commands to begin with:

1.DML (data manipulation language)
2.DDL (data definition language)
3.DQL (data query language)
4.TCL (transaction control language)
5.DCL (data control language)

Let us look at each of the command types in depth.

1.DML (data manipulation language)

When the tables are made and database is produced utilizing DDL directions, control inside those tables and databases is finished utilizing DML directions. The benefit of utilizing DML directions is, if in the event that any wrong changes or qualities are made, they can be changes and moved back effectively. DML directions incorporates:

INSERT
UPDATE
DELETE

2.DDL (data definition language)

So as to make/perform changes on the physical structure of any table dwelling inside a database, DDL is utilized. These directions when executed are auto-commit in nature and every one of the adjustments in the table are reflected and spared right away. DDL directions incorporates:

CREATE TABLE
ALTER TABLE
DROP TABLE
CREATE INDEX
ALTER INDEX
DROP INDEX
CREATE VIEW
DROP VIEW

3.DQL (data query language)

Data Query language comprises of just a single command over which information choice in SQL depends. SELECT command in combination with other SQL clauses is used to retrieve information from database table(s) based on specific conditions as requested by the client.

SELECT

This order, joined by numerous alternatives and provisos, is utilized to make queries against a social database. Queries, from easy to complex, from obscure to explicit, can be effectively made.

4.TCL (transaction control language)

SQL TCL directions are utilized to deal with changes which influence the information in database. Essentially we use these directions within the transaction or to influence a steady point amid changes in database at which we can later rollback the database state whenever required. In this class we have SAVEPOINT, ROLLBACK and COMMIT directions.

COMMIT Saves database exchanges

ROLLBACK Undoes database exchanges

SAVEPOINT Creates focus points inside gatherings of transactions in which to ROLLBACK

SET TRANSACTION Places a name on an exchange or also termed as a transaction

5.DCL (data control language)

Data management or control commands in SQL permit you to regulate access to information inside the database. These DCL commands are commonly accustomed to produce objects associated with user access and conjointly manage the distribution of privileges among users. Some information management commands or commonly called as Data control commands are as follows:

ALTER PASSWORD
GRANT
REVOKE
CREATE SYNONYM
You will notice that these commands are usually classified with alternative commands.

Another command which is of much use but is not displayed under the above mentioned categories is the Data Administration commands.

Data management instructions or called as Data Administration commands, allow the person to perform audits and carry out analyses on operations within the database. They can also be used to assist the examination of system performance. The two preferred information administration instructions are as follows:

START AUDIT
STOP AUDIT

Data Administration should not be confused with Database Administration. Database Administration deals with the entire management of the database, which incorporates the use of commands at all levels. Hence, it is more related to individual SQL implementations, compared to the core commands in SQL language.

This is my first post on Dev. :) Most of the references are taken from interviewbit.

. . .