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

Switch Statement In Java

Switch Statement:  The switch statement is just like if-else-if ladder statement. It executes one statement from multiple conditions. It works with a byte, short, int, long, and String. In other words, we can say the Switch case statement is a substitute for a long if statement that compares to several integral values. Syntax of Switch statement in java Enhance Switch or Switch With Arrow: The new syntax uses the -> operator instead of the colon we're used to with switch statements. Also, there's no break keyword. Another addition is the fact that we can now have comma-delimited criteria. Syntax of Enhance Switch in java  

Variables and Data types in Java

  MY PROGRAMMING PARADISE Variables: Variables are used to store data in a computer’s memory. In other words, we can say, variables are just like a container that holds the value while the java program executed. There are three types of variables in java: 1-  Local 2-  Instance 3-  Static   Rules for declaring identifier (Variable name) 1-  All identifiers must begin with a letter, currency character, or underscore. 2-  Blank spaces are not allowed. 3-  An identifier name is case-sensitive. 4-  A keyword cannot be used as an identifier.   Declaring variables: byte age = 28; short salary =32500; float price = 25.50f; char name = ‘v’; boolean flag=true;   Data types: There are two types of data types in java. 1-  Primitive Data type 2-  Non- primitive Data types   Primitive Data type: There are mainly eight types of primitive data types: Types Size Range Default Value byte 1 Byte [-128, 127] 0 short 2 Byte [-32,768 , 32...

Operators In SQL

Operators In SQL Operators: SQL generally contains some reserved words that are used to perform operations such as Arithmetical, Comparison and Logical Operations etc. These reserved words are known as Operators. Generally, there are three types of operators in SQL: i.       SQL Arithmetic Operators ii.       SQL Comparison Operators iii.      SQL Logical Operators SQL Arithmetic Operators Let assume variable A holds 20 and variable B holds 60 then: Operators                              Description     Example   + Add   A+B= will give 80   - Subtract   A-B= will give -40   * Multiply   A*B= will give 1200 ...