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 are covered in this SQL tutorial for beginners and professionals.
A database is a collection of data that has been organized.
DBMS refers to the Database Management System. It is a set of programs that enables you to store, modify, and retrieve data from a database.
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 does not define any constraints or security to ensure the ACID PROPERTY.
- Normalization concept is not present.
- In DBMS data is treated as files internally.
- DBMS does not support distributed databases.
- DBMS supports single user.
- RDBMS define the integrity constraint to ensure the ACID PROPERTY.
- Normalization concept is present.
- In RDBMS data is treated as tables internally.
- RDBMS support distributed databases.
- 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 are the instructions that 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 tables, views, 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 removes 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 remains.
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 users.
2. REVOKE – It withdraws 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 the original since the last COMMIT.
- SQL Syntax
- SQL data type
- SQL operators
- SQL CREATE Database
- SQL SHOW Database List
- SQL SELECT Database
- SQL DROP Database
- SQL CREATE Table
- SQL ALTER Table
- SQL COPY Table
- SQL RENAME Table
- SQL DROP Table
- SQL DELETE from table
- SQL TRUNCATE Table
- SQL CONSTRAINTS
- SQL PRIMARY KEY Constraint
- SQL FOREIGN KEY
- SQL NOT NULL Constraint
- SQL UNIQUE Constraint
- SQL INDEX Constraint
- SQL INSERT statement
- SQL UPDATE statement
- SQL SELECT statement
- SQL UNIQUE keyword
- SQL DISTINCT keyword
- SQL SELECT TOP
- SQL SELECT IN Operator
- SQL NOT IN Operator
- SQL BETWEEN Operator
- SQL NOT BETWEEN Operator
- SQL ALIAS Statement
- SQL WHERE Clause
- SQL AND Clause
- SQL OR Clause
- SQL UNION Operator
- SQL LIKE operator
- SQL ORDER BY Clause
- SQL GROUP BY clause
- SQL HAVING clause
- SQL JOIN clause
- SQL INNER JOIN
- SQL LEFT OUTER JOIN
- SQL RIGHT OUTER JOIN
- SQL FULL OUTER JOIN
- SQL SELF JOIN
- SQL CARTESIAN JOIN
- SQL Functions