Introduction to SQL

SQL stands for Structured Query Language and used to manipulate data in database. SQL is a standard language for all relational database like MySQL , ORACLE database, SQL Server etc.

Uses of SQL:

  • It is used to  access data in a RDBMS.
  • It is used to describe the data in a Rdbms.
  • It is used to define and manipulate the data in database  that data.
  • It is used to create, alter and drop databases and tables.
  • It is used to create view, stored procedure, functions, index in a database.
  • It is used to create users/schema and their respective profiles in the database.
  • It is used to set permissions on tables, procedures, and views in a database.

What is a Database?

A database is an organised collection of data/information so that it can be easily accessed, managed and modified.

What is DBMS?

DBMS stands for database management system is a software that is used to define, create, query, update, and administration of databases.

What is RDBMS?

RDBMS is stands for relational database management system where data is stored in form of  Relational Tables.A RDBMS is based on the relational model as invented by E. F. Codd.

SQL Statements

Basically all SQL commands falls into four category:

  • DML : Data Manipulation Language, used to insert, update, retrieve and delete the data in a database table.
  • DDL : Data Definition Language, used to create, alter and drop tables and other database objects.
  • DCL : Data Control Language, used for access and data control to database users.
  • TCL : Transaction Control Language, used for transaction control.

Data Manipulation Language (DML)

SELECT Used to retrieves certain records from one or more tables.
INSERT Used to insert  a record/row in a table.
UPDATE Used to modify records.
DELETE Used to delete records.

Data Definition Language (DDL)

CREATE Used to create a new table, view , or other database objects.
ALTER Used to modify a database object, such as a table.
DROP Used to delete an entire table, a view of a table or other database objects.

Data Control Language (DCL)

GRANT Used to give a privilege to user like create table, use session, create schema etc.
REVOKE Used to take back privileges granted for a user.

Transaction Control Language (TCL)

COMMIT Used to commit or save  a transaction at a particular point of time permanently
SAVEPOINT Used to save a transaction temporarily at a particular point, so that it can be rolled back.
ROLLBACK Used to rollback to a temporarily saved point of transaction.

Leave a Reply