0
0
SQLquery~5 mins

What is SQL

Choose your learning style9 modes available
Introduction
SQL helps us talk to databases to save, find, and change information easily.
When you want to save a list of your favorite books in a computer.
When you need to find all customers who bought a product last month.
When you want to update the price of items in a store's database.
When you want to organize and sort data like names or dates.
When you want to delete old or wrong information from a database.
Syntax
SQL
SQL is a language made of commands like SELECT, INSERT, UPDATE, DELETE.
Example:
SELECT column_name FROM table_name;
SQL commands are easy to read and write, like simple English sentences.
Each command does a specific job with the data in the database.
Examples
This command gets all the information from the Customers table.
SQL
SELECT * FROM Customers;
This adds a new customer named Alice who is 30 years old.
SQL
INSERT INTO Customers (Name, Age) VALUES ('Alice', 30);
This changes Alice's age to 31.
SQL
UPDATE Customers SET Age = 31 WHERE Name = 'Alice';
This removes Alice's record from the Customers table.
SQL
DELETE FROM Customers WHERE Name = 'Alice';
Sample Program
We create a table for pets, add one pet named Buddy who is a dog, then get all pets.
SQL
CREATE TABLE Pets (Name VARCHAR(20), Type VARCHAR(20));
INSERT INTO Pets (Name, Type) VALUES ('Buddy', 'Dog');
SELECT * FROM Pets;
OutputSuccess
Important Notes
SQL works with tables that look like grids with rows and columns.
Commands like SELECT help you get data, while INSERT, UPDATE, DELETE change data.
SQL is used everywhere, from small apps to big websites.
Summary
SQL is a simple language to manage data in databases.
It uses commands like SELECT, INSERT, UPDATE, and DELETE.
You use SQL to save, find, change, or remove data easily.