Structured Query Language (SQL) is the standard language used to interact with relational databases.
- Mainly used to manage data. Whether you want to create, delete, update or read data, SQL provides commands to perform these operations.
- Widely supported across various database systems like MySQL oracle, PostgreSQL, SQL Server and many others.
- Mainly works with Relational Databases (data is stored in the form of tables).
Writing First SQL Query
Before running SQL queries you need to set up a database server like MySQL, PostgreSQL or SQLite. Here, we are going to use MySQL server. Follow below steps to set up a basic SQL Environment:
After your MySQL environment is set up, you can write your SQL program. Below is the example to display " Hello World" using SQL.
1. Create a database named test_db
CREATE DATABASE test_db;2. Use the test_db database
USE test_db;3. Create a table named greetings
CREATE TABLE greetings (
id INT PRIMARY KEY,
message VARCHAR(255)
);
3. Insert the message 'Hello, World!' into the greetings table
INSERT INTO greetings (id,message)
VALUES (1,'Hello, World!');
4. Retrieve the message from the greetings table
SELECT message FROM greetings;Output:

Note: Try replacing "Hello World!" with your name in the SQL query. It's a fun way to see how databases store and display your own data! Give it a try and watch your name pop up!
SQL Basics
Covers core concepts like introduction, data types, operators, commands, applications and SQL career path to build a strong foundation
SQL Database
This section guides you through the process of creating and managing databases. Learn how to create, select, rename and drop databases with practical examples.
SQL Tables
Tables are the core data structures in databases organizing data into rows and columns. This section covers how to create, modify and manage tables effectively.
SQL Queries
Master writing SQL queries to interact with and manipulate data stored in your tables. This section covers common query types and operations.
- SELECT Statement
- INSERT INTO
- INSERT Multiple Rows
- UPDATE Statement
- DELETE Statement
- DELETE Duplicate Rows
SQL Clauses
Unlock useful ways to filter organize and group your query results. Clauses help you refine your data extraction.
- WHERE Clause
- WITH Clause
- HAVING Clause
- ORDER By Clause
- Group By Clause
- LIMIT Clause
- Distinct Clause
- Row Limiting Clause
- Aliases
SQL Operators
SQL Operators refers to the fundamental symbols and keywords within the SQL that enable users to perform various operations. Operators let you build complex query conditions.
- Logical Operators
- LIKE Operator
- IN Operator
- NOT Operator
- NOT EQUAL Operator
- IS NULL Operator
- UNION Operator
- UNION ALL Operator
- EXCEPT Operator
- BETWEEN Operator
- ALL & ANY
- INTERSECT Operator
- EXISTS Operator
- CASE Operator
SQL Aggregate Functions
SQL Aggregate Functions help calculate totals, averages and other summary values from data easily.
Data Constraints
Constraints define rules on data to ensure accuracy, consistency and prevent invalid entries in the database.
- NOT NULL Constraints
- Primary Key Constraints
- Foreign Key Constraints
- Composite Key
- Unique Constraints
- Alternate Key
- CHECK Constraints
- DEFAULT Constraints
SQL Joins
SQL joins combine data from multiple tables based on related columns to retrieve meaningful results.
- Introduction
- Outer Join
- Left Join
- Right Join
- Full Join
- Cross Join
- Self Join
- UPDATE with JOIN
- DELETE JOIN
- Recursive Join
SQL Functions
SQL functions offer an efficient and versatile approach to data analysis. Enhance your queries with built-in functions that manipulate data types and perform calculations.
- Date Functions
- String Functions
- Numeric Functions
- Statistical Functions
- JSON Functions
- Conversion Functions
- Datatype Functions
- LTRIM Function
- UPPER Function
- RTRIM Function
SQL Views
Focuses on creating and managing views using CREATE, UPDATE, RENAME and DROP VIEW for simplified and secure data access.
SQL Indexes
Improve query performance by creating indexes that speed up data retrieval.
SQL Subquery
Covers nested queries including subqueries, correlated subqueries and nested queries for complex data retrieval.
Advanced SQL & Databases
Covers advanced concepts like query optimization, complex operations and handling large-scale databases using joins, functions and stored procedures.
Database Design & Modeling
Includes ER modeling, ER diagrams, mapping to relational models, normalization, functional dependencies and design techniques to build efficient and scalable databases.
- Introduction
- Entity Relationship Diagrams (ERDs)
- Mapping from ER Model to Relational Model
- Introduction of Database Normalization
- Functional Dependency & Attribute Closure
- Types of Functional dependencies
- Rules of Inference
- Normal Forms in DBMS
- Denormalization in Databases
- Database Design
Database Security
Focuses on protecting databases using SQL injection prevention, encryption, backup and recovery techniques to ensure data safety and integrity.
- Injection
- Types of SQL Injection
- Data Encryption
- Database Recovery Techniques
- Backup
- Restore SQL Server Database From Backup
Database Connectivity
Explains how applications connect to databases using technologies like ORM, ODM and ODBC for efficient data interaction across programming languages.
Miscellaneous Topics
Explore advanced and useful SQL concepts to deepen your knowledge
- Wildcards Operators
- Comments
- Pivot and Unpivot
- Trigger
- Hosting
- Performance Tuning
- Stored Procedures
- Transactions
- Using Sequences
- Auto Increment
- Window functions
- Cursors
- Common Table Expressions
- Database Tuning
- Dynamic
- Regular Expressions
Exercises, Interview Questions & Cheat Sheet
Provides practice exercises, interview questions and a cheat sheet for quick revision of SQL concepts.
Latest Trend [2025]: SQL Server 2025 introduces AI-driven features directly within the SQL engine. It supports native vector data types and AI model management, allowing developers to run AI tasks directly in SQL without external tools.