1. What is SQL? Introduction to Databases
This lesson introduces SQL and relational databases, explaining key concepts with examples and tables.
What is SQL?
SQL (Structured Query Language) is the standard language used to interact with relational databases. It allows you to:
- Store data
- Retrieve data
- Update data
- Delete data
- Manage database structures
SQL is widely used in web development, data analysis, and enterprise applications.
What is a Database?
A database is an organized collection of data. It stores information in a structured format, making it easy to access and manage.
Types of Databases:
- Relational Databases (e.g., MySQL, PostgreSQL, SQLite): Use tables with rows and columns.
- NoSQL Databases (e.g., MongoDB, Cassandra): Use documents, key-value pairs, or graphs.
This tutorial focuses on relational databases and how to interact with them using SQL.
What is a Table?
A table is the basic unit of data storage in a relational database. It resembles a spreadsheet:.
- Rows = individual records
- Columns = attributes or fields
Example: Employees Table
| ID | Name | Department | Salary |
|---|---|---|---|
| 1 | Alice | HR | 50000 |
| 2 | Bob | IT | 60000 |
| 3 | Charlie | Finance | 55000 |
Why Learn SQL?
- Data Analysis: Query and analyze data efficiently.
- Web Development: Manage backend databases.
- Business Intelligence: Integrate with tools like Tableau and Power BI.
- Career Opportunities: SQL is a top skill in tech and data roles.
Quick Example
Get all employees in the IT department:
SELECT * FROM Employees
WHERE Department = ‘IT’;
This query tells the database: “Give me all the rows from the Employees table where the Department is ‘IT’.”
Summary
- SQL is the language for interacting with relational databases.
- Databases store structured data in tables.
- SQL is essential for data-related careers and applications.