0% found this document useful (0 votes)
2 views4 pages

Introduction To SQL

SQL, or Structured Query Language, is a programming language used by data analysts to communicate with databases for storing, retrieving, filtering, and analyzing data. It is essential for generating insights from large datasets, as demonstrated through real-life examples in online shopping and food delivery companies. The document also explains the concepts of databases, tables, rows, and columns, and outlines the typical SQL workflow in a business setting.

Uploaded by

Syed Arsalan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Introduction To SQL

SQL, or Structured Query Language, is a programming language used by data analysts to communicate with databases for storing, retrieving, filtering, and analyzing data. It is essential for generating insights from large datasets, as demonstrated through real-life examples in online shopping and food delivery companies. The document also explains the concepts of databases, tables, rows, and columns, and outlines the typical SQL workflow in a business setting.

Uploaded by

Syed Arsalan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Introduction to SQL
What is SQL?
SQL stands for: Structured Query Language. SQL is a programming language used to communicate with
databases. It helps us:
• Store data
• Retrieve data
• Filter data
• Analyze data
• Update data
Data analysts use SQL to work with business data and generate insights.
Real-Life Example of SQL
Suppose you work for an online shopping company like Amazon. The company stores:
• Customer details
• Product information
• Orders
• Payments
Now the manager asks:
• Which product sold the most?
• Which city has the highest sales?
• How many customers ordered this month?
A Data Analyst uses SQL queries to answer these questions.
Why Data Analysts Use SQL
Data analysts use SQL because companies store huge amounts of data in databases. SQL helps analysts:
• Analyze sales data
• Create reports
• Find trends
• Understand customer behavior
• Prepare dashboards
• Make business decisions
Real-Life Example
Imagine a food delivery company. The database contains:
• Customers
• Restaurants
• Orders
• Delivery details
A manager asks: “Find the total sales from Delhi this month.” A Data Analyst writes an SQL query to get the
answer quickly. Example:
SELECT SUM(amount)
FROM orders
WHERE city = 'Delhi';
Explanation:
• SUM(amount) calculates total sales
• WHERE city = 'Delhi' filters Delhi orders

Database vs Table vs Row vs Column


Understanding these four terms is very important.
1. Database
A database is a collection of organized data. Think of it as a large digital storage system. Example: A school
database may contain:
• Students table
• Teachers table
• Fees table
• Attendance table
Real-Life Example: Hospital Database - A hospital database may contain:
• Patients table
• Doctors table
• Medicines table
• Appointments table
All these tables together form a database.
2. Table
A table stores data in rows and columns. Example: students Table
student_id name city marks
1 Ali Delhi 85
2 Sara Mumbai 92
3 John Delhi 76

Real-Life Example: In an e-commerce company: orders Table


order_id customer amount
101 Ali 5000
102 Sara 7000
3. Row
A row represents one complete record. Example:
| 1 | Ali | Delhi | 85 |
This row contains information about one student.
Real-Life Example
In a customer table:
| 201 | Ahmed | Delhi |
This row represents one customer.
4. Column
A column represents one category of information. Example columns:
• student_id
• name
• city
• marks
Real-Life Example
In an employee table:
| emp_id | emp_name | salary | department |
Here:
• salary is a column
• department is a column
Each column stores one type of information.

SQL Workflow in Real Life


Now let us understand how SQL is used in real companies.
Step 1: Company Collects Data
A company collects data from:
• Websites
• Mobile apps
• Billing systems
• Customers
Example: An online shopping website stores:
• Orders
• Payments
• Customer details
Step 2: Data is Stored in Database
All data is stored inside databases using software like:
• MySQL
• PostgreSQL
• Microsoft SQL Server
Step 3: Data Analyst Writes SQL Queries
The analyst writes SQL queries to analyze data.
Example:
SELECT city, SUM(amount)
FROM orders
GROUP BY city;
Purpose:
Find total sales for each city.
Step 4: Reports and Dashboards are Created
After analysis:
• Reports are created
• Dashboards are prepared
• Business decisions are made
Tools often used:
• Microsoft Power BI
• Tableau
• Microsoft Excel

Complete Real-Life Workflow Example


Example: Food Delivery Company
Step 1: Customers place food orders.

Step 2: Data is stored in database tables like:


• customers
• restaurants
• orders

Step 3: Data Analyst writes SQL queries. Example:


SELECT restaurant_name, COUNT(order_id)
FROM orders
GROUP BY restaurant_name;
Purpose:
Find number of orders for each restaurant.

Step 4: Manager uses the report to:


• Identify top restaurants
• Increase promotions
• Improve business strategy

You might also like