Tuesday, April 09, 2019

Introduction of SQL

WHAT IS SQL?

SQL is Structured Query Language. Which used for fetching the Data from Relational Database. SQL was designed by Donald D. Chamberlin and Raymond F. Boyce at 80’s.

WHY SQL?


·         Define the Database/ Tables.
·         Fetching the requested Data.
·         Manage the Actual Data.
·         Define the authorised user to the Data.
               
LIST OF SUBLANGUAGES:

1.       Data Definition Language:

It is used for define (create/modify) the SQL objects like Tables, Views.

·         Create
·         Alter
·         Truncate
·         Drop
Syntax: 
                 Create Database <databaseName>
                 Alter table <tableName> …
                Truncate table <tableName>
                Drop Proc <prcedureName>
Example:
                 Create table Number (No int, Word varchar (20))


2.       Data Manipulate Language:

It is used for manage the actual Data. Manage means adding, modify and removing the data.
·         Insert
·         Update
·         Delete
Syntax: 
                  Insert into <tablename> [columnNames…] values (values…..)
                  Update <tableName> set columnName = value [where columnName = value]
    Delete from <tableName> [where columnName = value]
                Example:
                                Insert into Number (No, Word) values (1,’One’)

3.       Data Query Language:

It fetches the Data from the Database.
·         Select
Syntax: 
                 Select <columnNames> from <tablename> [where columnName = value]
                Example:
                            Select * from Number

4.       Data Control Language:

It deals with access of user.
·         Grant
·         Revoke
Syntax: 
                Grant <privilege> on <objectName> to <userName> [with grant option]
                Example:
                            Grant Select, Insert on Number to traineeuser.
                            Revoke Select, Insert on Number from traineeuser.

5.       Transaction Control Language:

It is used for manage the Transactions in Database.
·         Set transaction
·         Savepoint
·         Commit
·         Rollback
Syntax: 
                Savepoint < savepointName >
                Rollback < savepointName >
                Example:
                            Savepoint afterInsert
                            Rollback afterInsert

Note: All above queries are will be explained on following days. So stay tuned.



Thanks and Regards,
Ranjith Kumar S

Trichirappalli
India.

No comments:

Post a Comment

What is What? Part-II

WHAT IS PAGE? ‘Page’ is fundamental unit of Data in SQL. An each page has 8KB size. The arrangement of continuous eight pag...