0% found this document useful (0 votes)
0 views

SQL Notes1

SQL, developed in the early 1970s by IBM, is a standard language for managing and querying data in relational database systems. It supports various database management systems like MySQL, Oracle, and PostgreSQL, and includes key features such as data integrity and relationships between tables. SQL clauses and JOINs are essential for retrieving, filtering, and combining data from multiple tables for analysis.

Uploaded by

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

SQL Notes1

SQL, developed in the early 1970s by IBM, is a standard language for managing and querying data in relational database systems. It supports various database management systems like MySQL, Oracle, and PostgreSQL, and includes key features such as data integrity and relationships between tables. SQL clauses and JOINs are essential for retrieving, filtering, and combining data from multiple tables for analysis.

Uploaded by

alansiju010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

SQL, short for Structured Query Language, was introduced in the early 1970s.

It
was developed by Donald D. Chamberlin and Raymond F. Boyce at IBM. They
designed it to manage and query data stored in relational database systems
based on the relational model formulated by Edgar F. Codd.

SEQUEL - Structured English Query Language

SQL

The first version of SQL was created as part of a project called System R, which
aimed to demonstrate the feasibility of relational databases. Over time, SQL
became the standard for relational database management systems, and today, it
is widely used in applications ranging from small-scale projects to enterprise
systems.

SQL database software:


- MySQL
- Microsoft SQL Server
- PostgreSQL
- Oracle Database
- SQLite
- MariaDB
- IBM Db2
- Amazon RDS (Relational Database Service)
- Google Cloud SQL
- Snowflake

DBMS (Database Management System) and RDBMS (Relational


Database Management System) are systems for managing data.
OLTP vs OLAP
Example OLTP: Oracle, SQL Server…etc
Example OLAP: Power BI, Tableau….Analticalll….Data Wareshouse
DBMS (Database Management System)
- Definition: A software used to store, retrieve, and manage data in databases.
- Data Structure: Organizes data in a file-based or hierarchical manner (not
necessarily tables).
- Examples: XML Database, Microsoft Access.
- Limitation: Lacks support for relationships between data and constraints like
primary keys.
- Example: A student database where data is stored in separate files, e.g., a
"Student Details" file and a "Student Scores" file.

RDBMS (Relational Database Management System)


- Definition: An advanced type of DBMS where data is stored in tables and
relationships between data are defined.
- Data Structure: Uses tables (rows and columns) with unique keys (like primary
and foreign keys) to establish relationships.
- Examples: MySQL, PostgreSQL, Oracle Database.
- Feature: Enforces integrity constraints (e.g., no duplicate entries for primary
keys).
- Example:
- Students Table:

student name age


_id
1 Alice 20
2 Bob 22

- Scores Table:

student score
_id subject
1 Math 95
2 Science 89

Relationships between these tables (using `student_id`) allow easy queries, such
as retrieving a student’s name and their scores.

MySQL is an open-source relational database management system (RDBMS)


widely used for storing and managing data. It organizes data into tables, allowing
for efficient querying, updating, and analysis. Here's a quick overview:
- Key Features:
- Uses SQL (Structured Query Language) for interacting with databases.
- Supports multiple users and large-scale applications.
- Known for its speed, reliability, and ease of use.

- Applications:
- Commonly used in web development (e.g., for storing user information,
orders, and more).
- Works well for both small-scale projects and enterprise-level systems.

- Why It’s Popular:


- It's free and open-source.
- Highly compatible with programming languages like PHP, Python, and Java.

MySQL is part of the LAMP stack (Linux, Apache, MySQL,


PHP/Python/Perl) and is the backbone of many modern web
applications.

Clauses in SQL help define and modify the behavior of queries


SELECT Clause: Retrieves specific data from a database. It's used to specify
which columns you want to fetch. For example, if you're analyzing sales data,
you might retrieve only the product names and their prices.
WHERE Clause: Filters data by applying conditions. It helps extract only
relevant records based on criteria like dates, values, or patterns. For instance,
you could use it to find sales transactions that exceed a certain amount.
GROUP BY Clause: Groups rows that share a common value. It’s commonly
used with aggregation functions to summarize data. For example, you can group
sales data by region to calculate the total revenue generated in each region.
ORDER BY Clause: Sorts data in ascending or descending order. It’s useful for
ranking or arranging results. For example, you might sort sales records by total
revenue to find the highest-performing sales.
Aggregation in the context of databases refers to the process of
summarizing or combining data from multiple rows into a single value,
based on a specific operation. It is used to derive insights from large
datasets by applying mathematical functions.

For example:
- SUM: Combines values in a column to calculate a total.
- AVG: Computes the average of values in a column.
- COUNT: Counts the number of entries in a column.
- MAX: Identifies the largest value in a column.
- MIN: Finds the smallest value in a column.

Aggregations are commonly used in analytics, reporting, and data visualization


to understand trends, patterns, and metrics across datasets.

JOINs are used in SQL to combine data from two or more tables based
on related columns, making it easier to analyze financial records across
multiple tables.

- INNER JOIN: Returns only matching rows from both tables. For example, if you
have a `Transactions` table and an `Accounts` table, an INNER JOIN will show
transactions that match accounts in both tables.

- LEFT JOIN: Returns all rows from the left table and matching rows from the
right table. If there’s no match in the right table, NULL is displayed for the
unmatched data. For example, you can list all accounts, even if some have no
transactions recorded.

Both are essential for extracting and correlating financial data across tables.

You might also like