SQL

SQL tutorial for beginners and professionals with examples on Basics, Structured, Programming, Language, Syntax, Database, Clauses, database concepts, SQL Syntax, SELECT, INSERT, DELETE, UPDATE, DROP, TRUNCATE, DISTINCT, ORDER BY, GROUP BY, WHERE and more.

A database is an organized collection of data.

DBMS:

DBMS refers to the Database Management System. It is a set of programs that enables you to store, modify, and retrieve the data from a database.

RDBMS:

RDBMS refers to the Relational Database Management System. It is a database management system that is based on the relational model as introduced by E. F. Codd. All modern database systems like MS SQL Server, Oracle, IBM DB2, MySQL, and Microsoft Access are based on RDBMS.

Difference between DBMS and RDBMS:

                              DBMS                            RDBMS
  1. DBMS does not define any constraints or security to ensure the ACID PROPERTY.
  2. Normalization concept is not present.
  3. In DBMS data is treated as files internally.
  4. DBMS does not support distributed databases.
  5. DBMS supports single user.
  1. RDBMS define the integrity constraint to ensure the ACID PROPERTY.
  2. Normalization concept is present.
  3. In RDBMS data is treated as tables internally.
  4. RDBMS support distributed databases.
  5. RDBMS supports multiple users.

SQL stands for Structured Query Language. SQL is a computer language for accessing databases. It is used to store, manipulate and retrieve the data stored in a database.

SQL Commands:

SQL Commands are the instructions which are used to interact with the database to perform a specific task.

SQL Commands categories:

1. DDL (Data Definition Language):
DDL commands are used to define the structure of database objects.

1. CREATE – It is used to create database objects like table, view etc.

2. ALTER – It is used to alter the structure of the existing database object.

3. DROP – It is used to delete the existing objects from the database.

4. TRUNCATE – It remove all records from a table, including all spaces allocated for the records will be removed.

5. RENAME – It is used to rename an existing database object.

2. DML (Data Manipulation Language):
1. SELECT – It is used to retrieve the records from the database.

2. INSERT – It is used to create a record.

3. UPDATE – It is used to modify an existing record.

4. DELETE – It is used to delete all records from a table, the space for the records remain.

5. MERGE- It is used to insert or update a record.

6. CALL – call a PL/SQL or Java subprogram.

7. LOCK TABLE – It is used to control concurrency.

3. DCL (Data Control Language):
1. GRANT – It gives privileges to user.

2. REVOKE – It withdraw access privileges from a user given with the GRANT command.

4. TCL (Transaction Control):
1. COMMIT – It is used to save the work done.

2. SAVEPOINT – It is used to identify a point in a transaction to which you can roll back later.

3. ROLLBACK – It is used to restore the database to original since the last COMMIT.

SQL Tutorial:

Content Protection by DMCA.com

SQL interview questions: