SQL Tutorial: Learn SQL for Free

Welcome to our SQL tutorial, where you'll learn SQL (Structured Query Language) step-by-step in a simple and practical manner. This guide covers essential SQL concepts to help you progress from basic to advanced levels. Whether you're just starting or looking to strengthen your database programming skills, this tutorial is for you.



Sample Image

Example: SQL Query

Consider the following table, CUSTOMERS, which stores customer details:

ID Name Age Salary City Country
1 Ramesh 32 2000.00 Maryland USA
2 Reena 40 5000.00 New York USA
3 Ankit 29 4500.00 Muscat Oman

To retrieve customers from the USA, use the following SQL query:

Syntax

SELECT * FROM CUSTOMERS WHERE country = 'USA';
            
Output

ID   Name    Age   Salary   City      Country
1    Ramesh  32    2000.00  Maryland  USA
2    Reena   40    5000.00  New York  USA
            

Basic SQL Commands

Here are standard SQL commands, categorized into groups:

  • Data Definition Language (DDL): Commands to define and modify database structure.
    • CREATE: Create new tables or database objects.
    • ALTER: Modify existing database objects.
    • DROP: Delete tables or database objects.
    • TRUNCATE: Remove all records from a table.
  • Data Manipulation Language (DML): Commands to manipulate database data.
    • SELECT: Retrieve specific data.
    • INSERT: Add new data.
    • UPDATE: Modify existing data.
    • DELETE: Remove data.
  • Data Control Language (DCL): Commands to manage data access.
    • GRANT: Assign access permissions.
    • REVOKE: Remove access permissions.

Why Learn SQL?

SQL is essential for students and professionals in software development, banking, finance, and many other domains. It is widely used in applications to manage and manipulate data efficiently. Learning SQL enhances your programming skills and career prospects.

SQL Applications

SQL allows you to:

  • Query data from databases.
  • Define and manipulate database structures.
  • Create views, procedures, and functions.
  • Manage database user access and permissions.

SQL Online Quizzes

Test your SQL knowledge with our quizzes and assignments. Here's a sample question:

Question: Who developed SQL?

  • A. Google in the 1990s
  • B. Microsoft in the 1980s
  • C. IBM in the 1970s
  • D. None of the above

Answer: IBM in the 1970s