DEV Community

Punitha
Punitha

Posted on

SQL (Structured Query Language)

What is SQL?

SQL(Structured Query Language) is a database language used to store, retrieve, update, and manage data in a relational database.

Why Use SQL?

  • Store large amounts of data

  • Retrieve data quickly

  • Update existing records

  • Delete unwanted records

  • Generate reports and analysis

  • Manage relational databases

Benefits of SQL

  • Easy to learn

  • Fast data retrieval

  • Supports large datasets

  • Used in many industries

  • Works with databases like MySQL, PostgreSQL, SQL Server, and Oracle

SQL Syntax

  • SQL syntax refers to the set of rules used to write SQL statements correctly.

Basic Syntax

SELECT column_name
FROM table_name;
Enter fullscreen mode Exit fullscreen mode

SQL Keywords:

  • SELECT - Retrieve data

  • FROM - Specify the table

  • WHERE - Filter records

  • INSERT - Add new records

  • UPDATE - Modify existing records

  • DELETE - Remove records

  • CREATE - Create a database or table

  • ALTER - Modify a table

  • DROP - Delete a database or table

  • ORDER BY - Sort data

  • GROUP BY - Group records

  • HAVING - Filter grouped data

SQL Data Types

  • SQL data types define the type of data that can be stored in a table column.

  • INT - Stores whole numbers - 101

  • VARCHAR(n) - Stores text up to a specified length - 'database'

  • CHAR(n) - Stores fixed-length text - 'A'

  • DECIMAL(p,s) - Stores decimal numbers - 10.00

  • DATE - Stores dates - 29-07-2026

  • TIME - Stores time - 10:30:00

  • TIMESTAMP - Stores data and time - 2026-07-29 10:30:00

  • BOOLEAN - Stores TRUE or FALSE - TRUE

Top comments (0)