Home SQL
|
Introduction to SQL
Introduction to SQL

SQL (Pronounce : SEQUEL) stands for Structured Query Language.SQL is a standard computer language for accessing and manipulating databases. With SQL, you can query your database in a variety of ways, using English-like statements. SQL is an ANSI standard computer language. SQL can execute queries against a database, retrieve data from a database, insert new records in a database, delete records from a database, update records in a database.

 

SQL works with relational databases. A relational database stores data in tables (relations). A database is a collection of tables. A table consists a list of records - each record in a table has the same structure, each has a fixed number of "fields" of a given type.

Employee ID
Employee Name
Location
1000Mehul
Pune
1001
Jay
Ahmedabad
1002
Jalpesh
Ahmedabad
1003
Vishal
Mumbai

 

 

 

 

 

SQL Data Manipulation Language (DML) :

DML (Data Manipulation Language) statements are used for managing data within schema objects. It includes :

1. SELECT - retrieve data from the a database
2. INSERT - insert data into a table
3. UPDATE - updates existing data within a table
4. DELETE - deletes all records from a table, the space for the records remain
5. MERGE - UPSERT operation (insert or update)
6. CALL - call a PL/SQL or Java subprogram
7. EXPLAIN PLAN - explain access path to data
8. LOCK TABLE - control concurrency

 

SQL Data Definition Language (DDL) :

DDL (Data Definition Language) statements are used to define the database structure or schema. Some examples:

1. CREATE - to create objects in the database
2. ALTER - alters the structure of the database
3. DROP - delete objects from the database
4. TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed
5. COMMENT - add comments to the data dictionary
6. RENAME - rename an object

 

SQL Transaction Control Language (TCL) :

Manages the changes made by DML statements. These commands allow statements to be grouped together into logical transactions.

1. COMMIT - save work done
2. SAVEPOINT - identify a point in a transaction to which you can later roll back
3. ROLLBACK - restore database to original since the last COMMIT
4. SET TRANSACTION - Change transaction options like isolation level and what rollback segment to use

 

SQL Data Control Language (DCL) :

1. GRANT - gives user’s access privileges to database
2. REVOKE - withdraw access privileges given with the GRANT command

 

 

Polls

More information required for below categories?