articles

Home / DeveloperSection / Articles / SQL Introduction

SQL Introduction

Anonymous User8888 12-Jul-2011

Before discussing about what is SQL? Firstly we will discuss what is Database? “Databases are designed to offer an organized mechanism for storing, managing and retrieving information. They do so through the use of tables”. Database is a structured collection of records or data that is stored in a computer system where as SQL is stands for Structured Query Language, SQL is pronounced “Sequel” and is a simple non procedural language that lets you store and retrieve data in a relational database.

SQL is used to communicate with a database. According to ANSI (American National Standards Institute), it is the standard language for relational database management systems. SQL statements are used to perform many tasks such as update data on a database, or retrieve data from a database, or delete data from database etc.

There are four main category of SQL which are namely as follows:
  1.        Data Definition Language(DDL)
  2.        Data Manipulation Language(DML)
  3.        Data Control Language(DCL)
  4.       Transaction  Control Language(TCL)
  5.        Data Query Language (DQL)
Data Definition Language (DDL):

Data Definition Language is used for creating database structure or schema. There are many DDL commands in SQL. These SQL commands name are as follows:

  •  CREATE:   Create command is used for creating database structure.
  •  ALTER:  Alter command is used for altering database structure.
  •  DROP:   Drop command is used for delete object from database.
  •  TRUNCATE: Truncate command is used for remove all record form tables, including all spaces allocated for the records are removed.
  •  COMMENT: Comment command are used for add comments to data dictionary.
  •   RENAME: Rename command are used for rename object name.
Data Manipulation Language (DML):

Data Manipulation Language is used for managing data within schema object. There are lots of DML commands which are used in SQL in which some are namely defined below:

  •  INSERT:  Insert command is used for insert data into database table.
  •  DELETE: Delete command is used for deletes all records from a table, the space for the records remain.
  •  UPDATE: Update command is used for updates existing data into database table.
  •  MERGE:  Merge command is for merge data within database table perform insert, update command.
  •  CALL:   Call command is used for call PL/SQL block or java sub program.
  •  LOCK TABLE:  Lock table command is used for concurrency control within database.
  •  EXPLAIN PLAN: Explain command are used for explain access path to data.
Data Control Language (DCL):

Data control language are used for define the privileges of database access user. DCL command are widely used in corporate sector there are basically two main commands are used in DCL which are namely:

  •  GRANT:  Grant command is used for gives user’s access privileges to database.
  •  REVOKE: Revoke command is used for withdraw access privileges given with the GRANT command.
Transaction Control Language (TCL):

Transaction Control Language (TCL) is playing an important role in SQL. Transaction control language is used for statements are used to manage the changes made by DML statements. It allows statements to be grouped together into logical transactions. There are lots of TCL commands which are used in SQL in which some are namely defined as follows:

  •  COMMIT:  Commit command is used for save work done in database.
  •  SAVEPOINT:  Savepoint command is used for identify a point in a transaction to which you can later roll back.
  •  ROLLBACK: Rollback command is used for restore database to original since last commit.
  •  SET TRANSACTION: Set transaction command is used for Change transaction options like isolation level and what rollback segment to use.
Data Query Language (DQL):

Data query language basically used for select or retrieve data from database table. DQL has only one SQL command namely: SELECT

Example: Demonstrating SELECT Command
---- SELECT ALL DATA FIELD FROM USERLOGININFO TABLE IN DATABASE ARUNSINGH 
SELECT * FROM USERLOGININFO

Note: SQL commands are not case sensitive.



Updated 22-Mar-2018
I am a content writter !

Leave Comment

Comments

Liked By