0% found this document useful (0 votes)
25 views

INTRODUCTION TO SQL (3)

SQL (Structured Query Language) is a domain-specific language for managing data in relational databases, offering advantages like single-command access to multiple records. It includes various sublanguages such as DDL for defining database structures, DML for data manipulation, DCL for data access control, and TCL for transaction management. Key commands include CREATE, SELECT, GRANT, and COMMIT, each serving specific functions in database management.

Uploaded by

lmanjumanoj2009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

INTRODUCTION TO SQL (3)

SQL (Structured Query Language) is a domain-specific language for managing data in relational databases, offering advantages like single-command access to multiple records. It includes various sublanguages such as DDL for defining database structures, DML for data manipulation, DCL for data access control, and TCL for transaction management. Key commands include CREATE, SELECT, GRANT, and COMMIT, each serving specific functions in database management.

Uploaded by

lmanjumanoj2009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

INTRODUCTION TO SQL

SQL ( Structured Query Language) is a domain-specific language used in programming and


designed for managing data held in a relational database management system (RDBMS), or for
stream processing in a relational data stream management system (RDSMS). It is particularly
useful in handling structured data where there are relations between different entities/variables of
the data. SQL offers two main advantages, first, it introduced the concept of accessing many
records with one single command; and second, it eliminates the need to specify how to reach a
record, e.g. with or without an index.
Originally based upon relational algebra and tuple relational calculus, SQL consists of many
types of statements, which may be informally classed as sublanguages, commonly: a data query
language (DQL), a data definition language (DDL), a data control language (DCL), and a data
manipulation language (DML). The scope of SQL includes data query, data manipulation (insert,
update and delete), data definition (schema creation and modification), and data access control.
Although SQL is often described as, and to a great extent is, a declarative language (4GL), it
also includes procedural elements.

BASIC SQL COMMANDS

1. Data Definition Language (DDL)

DDL stands for data definition language and used to define database
patterns or structures. DDL is a syntax which is same as syntax of
computer programming language for defining patterns of database.
Few examples of it are:

 CREATE – used to create objects in database


 ALTER – alter the pattern of database
 DROP – helps in detecting objects
 TRUNCATE – erase all records from table
 COMMENT – adding of comments to data dictionary
 RENAME – useful in renaming an object

CREATE statement or command is used to create a new database. In


structured query language the create command creates an object in a
relational database management system. The commonly used create
command is as follows

 CREATE TABLE [name of table] ( [ definitions of column ]) [parameters


of table]

DROP statement destroys or deletes database or table. In structured


query language, it also deletes an object from relational database
management system. Typically used DROP statement is

 DROP type of object name of object

ALTER statement enhance the object of database. In structured query


language it modifies the properties of database object. The ALTER
statement is
 ALTER type of object name of object

RENAME statement is used to rename a database. It’s statement is as


follows

 RENAME TABLE old name of table to new name of table

2. Data manipulation language (DML)

It has statements which are used to manage the data within the pattern
of objects. Some of the samples of the statements are as follows:

 SELECT – useful in holding data from a database


 INSERT – helps in inserting data in to a table
 UPDATE – used in updating the data
 DELETE – do the function of deleting the records
 MERGE – this do the UPSERT operation i.e. insert or update operation
 CALL – this calls a structured query language or a java subprogram
 EXPLAIN PLAN – has the parameter of explaining data
 LOCK TABLE – this ha the function of controlling concurrency

3. Data Control Language (DCL)

Data Control Language (DCL) is syntax similar to the programming


language, which was used to retrieve the stored or saved data. Examples
of the commands in the data control language (DCL) are:

 GRANT – this permits particular users to perform particular tasks


 REVOKE – it blocks the previously granted untrue permissions

4. Transaction Control Language (TCL)

Transaction Control Language (TCL) has commands which are used


to manage the transactions or the conduct of a database. They manage
the changes made by data manipulation language statements and also
group up the statements in o logical management.
Some examples of it are:

 COMMIT – use to save work


 SAVE POINT – helps in identifying a point in the transaction, can be
rolled back to the identified point
 ROLL BACK – has the feature of restoring the database to the genuine
point, since from the last COMMIT
 SET TRANSACTION – have parameter of changing settings like isolation
level and roll back point
COMMIT command permanently save the transaction in to database.

 It’s syntax is: Commit;

ROLL BACK command uses the save point command to jump to save
point in transaction.

 It’ s syntax is: rollback to name-save point;

SAVE POINT command is used to save a transaction temporarily.

 It’s syntax is: Save point name-save point;

These are different types of DBMS languages, which are used to read,
upgrade, save information.

You might also like