INNER POST ADS

Recent Posts

Type of SQL commands

Tuesday, April 28, 2020

Type of SQL commands

SQL languages its commands on the basis of functionalities performed by them. there are five types of SQL language which can be classified as,

  • DDL (Data Definition Language)
  • DML (Data Manipulation Language)
  • DCL (Data Control Language)
  • DQL (Data Query Language)
  • TCL (Transaction Control Language)

Data Definition Language

Data definition language statements are used to define the database structure or schema.

DDL commands
  • CREATE - used to create tables or databases 
                              CREATE table student;
  • ALTER - used to modify the values in the table 
                               ALTER table student add column entroll_number int;
  • RENAME - used to rename the table or database name
                                RENAME student to student_details;
  • DROP - used to delete the table from the database
                                DROP table student_details;
  • TRUNGATE - used to delete the table from the database
                                 TRUNGATE student_detail;

Data Manipulation Language

Data manipulation language statements are used for managing data whithin schema objects.

DML commands

  • INSERT - used to insert new record in the table

                           INSERT into student(name,entroll_number)values("john",456123);

  • UPDATE - used to update values of existing rows of table

                           UPDATE student set name="Darkoor"
                           WHERE name="john";

  • DELETE- used to delete row or entire table.

                           DELETE table student;


  • LOCK  - used to lock the privilages as either read or write

                           LOCK table student read;


Data Control Language

A data control language is used to control access to stored in database.

DCL commands

  • GRANT- used to mprovide access to user

                         GRANT CREATE table to user1;

  • REVOKE - used to take back the access privilages from  the users

                         REVOKE CREATE table from user1;



Data Query Language

Data query language consists of only one command over which data selection in SQL relies.

  • SELECT -used to fetch the data from the table/database

                           SELECT* from student_details;



Transaction Control Language

Transaction control language commands are used to manage transaction in database it also allows statements tobe groped together in to logical transaction.

TCL commands

  • COMMIT - usecto deploy or apply or save the changes in the database.

                              COMMIT;

  • ROLLBACK - used to cancel or undo changes made in the database.

                              ROLLBACK;
                     
  • SAVEPOINT -used to save the data on temporary basis in the database.

                              SAVEPOINT entroll_number;



No comments:

Post a Comment