Professional Documents
Culture Documents
SQL (Structured Query Language) : Database
SQL (Structured Query Language) : Database
SQL (Structured Query Language) is a standard interactive and programming language for getting
information from and updating a database. Queries take the form of a command language that lets you
select, insert, update, find out the location of data, and so forth.
What is SQL?
SQL stands for Structured Query Language. 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(dbms). SQL statements are used to perform tasks such
as update data on a database, or retrieve data from a database. Some common relational database
management systems(dbms) that use SQL are: Oracle, Sybase, Microsoft SQL Server, Access,
Ingres, MySQL, etc. Although most database systems use SQL, most of them also have their
own additional proprietary extensions that are usually only used on their system. However, the
standard SQL commands such as "Select", "Insert", "Update", "Delete", "Create", and "Drop"
can be used to accomplish almost everything that one needs to do with a database. To use SQL
we need an SQL Interpreter.
SQL language is divided into four types of primary language statements: DML, DDL, DCL and
TCL. Using these statements, we can define the structure of a database by creating and altering
database objects, and we can manipulate data in a table through updates or deletions. We also
can control which user can read/write data or manage transactions to create a single unit of work.
DML statements affect records in a table. These are basic operations we perform on data such as
selecting a few records from a table, inserting new records, deleting unnecessary records, and
updating/modifying existing records.
DDL statements are used to alter/modify a database or table structure and schema. These
statements handle the design and storage of database objects.
DCL statements control the level of access that users have on database objects.
TCL statements allow you to control and manage transactions to maintain the integrity of data
within SQL statements.
Data Definition Language (DDL) statements are used to define the database structure or schema. Some
examples:
Data Manipulation Language (DML) statements are used for managing data within schema objects.
Some examples:
DCL
TCL
Transaction Control (TCL) statements are used to manage the changes made by DML statements. It
allows statements to be grouped together into logical transactions.
-------------------------------------------------------------------------------------------------------------------------------------
DDL
DDL is short name of Data Definition Language, which deals with database schemas and descriptions, of
how the data should reside in the database.
CREATE – to create database and its objects like (table, index, views, store procedure, function and
triggers)
TRUNCATE – remove all records from a table, including all spaces allocated for the records are removed
DML
DML is short name of Data Manipulation Language which deals with data manipulation, and includes
most common SQL statements such SELECT, INSERT, UPDATE, DELETE etc, and it is used to store,
modify, retrieve, delete and update data in database.
DCL
DCL is short name of Data Control Language which includes commands such as GRANT, and mostly
concerned with rights, permissions and other controls of the database system.
TCL
TCL is short name of Transaction Control Language which deals with transaction within a database.