SQL Tutorial



INTRODUCTION TO SQL


Introduction to SQL

SQL (Structured Query Language) is the standard language used to communicate with relational databases. It allows you to create, read, update, and delete data efficiently, which is often referred to as CRUD operations.

πŸ’‘ Did You Know? SQL is used by popular databases like MySQL, PostgreSQL, SQLite, Oracle, and Microsoft SQL Server.

πŸ“š What Can SQL Do?

  • Retrieve data from a database
  • Insert new records into a table
  • Update existing records
  • Delete records
  • Create and manage database tables
  • Set permissions on tables, procedures, and views

πŸ”  Basic SQL Syntax

A basic SQL query looks like this:

SELECT column1, column2 FROM table_name WHERE condition;
  

Let’s break it down:

  • SELECT – Specifies the columns to retrieve
  • FROM – Specifies the table to query
  • WHERE – Filters records based on conditions

πŸ§ͺ Live-Like Example

Imagine we have a table called students:

+----+----------+--------+
| id | name     | grade  |
+----+----------+--------+
| 1  | John     | A      |
| 2  | Priya    | B      |
| 3  | Michael  | A      |
+----+----------+--------+
  

To select all students with grade 'A', you would write:

SELECT * FROM students WHERE grade = 'A';
  

πŸ“ Tip: The asterisk (*) selects all columns from the table.

πŸ“Œ Common SQL Commands

  • SELECT – Get data
  • INSERT INTO – Add new data
  • UPDATE – Modify existing data
  • DELETE – Remove data
  • CREATE TABLE – Make a new table
  • DROP TABLE – Delete a table completely

πŸ” SQL is Case-Insensitive

SQL keywords like SELECT, FROM, and WHERE are not case-sensitive. However, it’s a good practice to write them in uppercase for clarity.

βœ… Summary: SQL is the core of working with databases. Mastering basic commands like SELECT, WHERE, and INSERT will help you query and manage data like a pro.


🌟 Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review