Skip to main content

Types of SQL Commands

 

Types of SQL Commands

SQL: SQL commands are used for communicating with the database. There are a total of 5 types of SQL commands

1. DDL (Data Definition Language)

2. DML (Data Manipulating Language)

3. DCL (Data Control Language)

4. TCL (Transaction Control Language)

5. DQL (Data Query Language)



1. DDL (Data Definition Language): Data Definition Language helps us to define database structure.

·      Create: Create statement is used to define a database.

·      Drop: Drop statement is used to remove the table and database from RDBMS.

·      Alter: Alter statement is used to add, delete or modify columns in an existing table.

·      Truncate: Truncate command is used to delete all the records from the table and free the space containing the table.

2. DML (Data Manipulating Language): Data Manipulating Language allows us to modify the database instance.

·      Insert: Insert statement is used to insert data in the MYSQL table.

·      Update: Update command is used to update the existing records in a table.

·      Delete: Delete command is used to remove one or more records from a table.

3. DCL (Data Control Language): Data Control Language is used to grant and take back "rights & permissions" from any other database user.

·      Grant: Grant command is used to provide access or privileges on the database objects to the users.

There are two types of privileges

1. System Privileges(CREATE, ALTER, DROP)

2. Object Privileges(EXECUTE, SELECT, INSERT, UPDATE OR DELETE)

 

·      Revoke: Revoke command is used to take back access or privileges from the user.


4. TCL (Transaction Control Language): Transaction Control Language deals with the transaction within the database. These commands can only use with the Data Manipulating Commands.

·      Commit: Commit command is used to save all the changes to the database.

·      Rollback: Rollback command allows us to undo transactions that have not been saved to the database.

·      SavePoint: Savepoint command helps us to set a savepoint within a transaction.  


5. DQL (Data Query Language): This command helps us to fetch the data from the database.

·    Select:  Select command is used to fetch the data from the MySQL database.


 

 

                                            

Comments

Popular posts from this blog

Methods of String in java

  String in Java String:   A Java string is  a sequence of characters that exist as an object of the class java. lang. Here is  the list of important methods available in the java string class: Ø  startsWith ( ): It checks if the string starts with the given prefix. If yes then return true else false. Ø  endsWith () : It checks if the string ends with the given suffix. If yes then return true else false. Ø  substring(int begin index) : It return s  the substring of the string. The substring start s  with the character at the specified index. Ø   substring(Int begin index , int end index) : Returns the substring. The substring starts with the character at begin index and ends with the character at end index. Ø  toLowerCase() : It converts all  the character s  of the string into lower case(Small Letters).   Ø  toUpperCase() : It converts all the character s  of the string into upper case(Capital Let...

Data Types In SQL

  Data Types In SQL W hat is Data Type? A data type as the name suggests it is the type or category to which the data belongs to. A data type specifies a particular type of data, such as integer, floating-point, Boolean, etc. In SQL, the data type defines the type of data to be stored in each column of a table. SQL data types can be broadly divided into three categories 1.       Numeric Data Types 2.       String Data Types 3.       Data & Time Data Types Numeric Data Types String Data Types Data&Time DataTypes BIT CHAR(SIZE) DATE TINYINT VARCHAR(SIZE) TIME SMALLINT TEXT(SIZE) DATETIME MEDIUMINT TINYTEXT(SIZE) TIMESTAMP INT MEDIUMTEXT(SIZE) YEAR BIGINT LONGTEXT   ...

Conditional Statements In Java

  Conditionals Statement   A conditional statement  is a set of rules performed if a certain condition is met. A conditional statement begins with the keyword if followed by parentheses. The result of the evaluation is true or false. ·       ‘ if ‘ statement ·       ‘ if-else ‘ statement ·         Nested ‘ if ‘ statement ·       ‘ if-else - if ‘ statement IF statement: ‘IF’ statement is the most basic and simple statement among all the statements. For example- if a value is less than 0, return “Negative value”. Let’s see an example- IF-ELSE statement: The if-else is statement is an extended version of If. Let’s see an example- Nested IF-ELSE statement : In Java, when there is an if statement inside another if statement then it is known as nested if-else. Let’s see an example- IF-ELSE-IF: ‘ if-else-if ’ statement is used when we need to check mul...