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 |
|
|
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:
- 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 INSERT statement
- SQL INDEX Constraint
- SQL UPDATE statement
- SQL SELECT
- 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
- 5 Greatest General public Datasets to Observe Your Info Investigation Capabilities
- Understanding T-SQL Function SUBSTRING and Its Use Cases
- Getting Started With SQL Function PATINDEX and Its Use Cases
- CockroachDB TIL: Volume 7 – W3scools Database
- Improving Performance in a Hierarchical SQL Structure
- SQL CTE: How to Master It With Easy Examples
- Using SingleStoreDB, MindsDB, and Deepnote
- SQL vs. NoSQL: Pros and Cons
- Five Tips to Fasten Skewed Joins in Apache Spark
- Blind SQL Injection — Threat or Child’s Play?
- SQL Database Schema: Beginner’s Guide
- What You Should Know About Table Partition Pruning
- Performance Tuning Strategies for SQL Server Index
SQL interview questions: