Introduction
What is a Database?
A Database is a collection of data stored in a format that
can easily be accessed.
It lets you to:
- Store data in an organized way.
- Access data easily.
- Update data.
- Delete data.
Real-Word Use Cases
1. Social Media Platforms.
2. Library Management System.
3. HRM System.
4. Content Management Systems.
5. Transportation and Logistics.
6. E-learning Systems.
7. Banking and Finance.
8. Point of Sale Systems.
9. Energy and Utilities.
10. Travel Agencies.
11. Supply Chain Systems.
12. Government and Public Sector.
Database Management System
Database Management (DBMS) System is a software used to manage database. It provides an interface for creating, storing, and retrieving, updating, and managing data in a structured manner.
Two Categories of DBMS.
1. Relational Database Management System.
2. Non-Relational Database Management System.
How (DBMS) Works
1. User Interface.
2. Query Processing.
3. Query Optimization.
4. Accessing Data.
5. Data Retrieval or Modification
6. Security.
Relation Database Management System
Is a type of database management system that stores data
into tables.
Tables can be linked to establish relationships.
SQL is the language we use to work with these relational
database management systems.
There are a lot of relational database management systems,
some of them are:
- MySQL
- SQL Server
- SQLite
- PostgreSQL
Non-Relational Database Management System
Is a type of database management System that stores data in
a format such as documents, graphs or key-values pairs rather than tables.
They are also called NoSQL databases.
Good example is:
- MongoDB
- Redis
- Cassandra
What is SQL?
SQL (Structured Query Language) is a standard computer language used for accessing and manipulating databases. It consist of set of commands called query, which is used to insert, update, and manage both data and database itself. SQL lets you access and manipulate database. SQL became a standard of the America National Standards Institute (ANSI) in 1986, and of the international Organization for Standardization (ISO) in 1987.
What SQL Can Do?
Using SQL, you can:
1. Retrieve data from a database.
2. Insert data into a database.
3. Update data stored in a database.
4. Delete data stored in a database.
5. Create, and Delete databases and database tables and more.
SQL Can Be Broken Down into
1. DDL (Data Definition Language): Used to create and modify the structure
of your database, like tables and relationships between tables.
2. DML (Data Manipulation Language): Used to insert, update, and delete
data stored in a database.
SQL Platform
1. MySQL
2. SQL Server
3. PostgreSQL
4. SQLite
Continue
1. SQL can create new databases.
2. SQL can create new tables in a database.
3. SQL can create stored procedures in a database.
4. SQL can create views in a database.
5. SQL can set permissions on tables, procedures, and views.
Using SQL in Your Web Site
To build a web site that shows data from a database, you
will need:
1. An RDMS database program (i.e. MS Access, SQL Server,
MySQL)
2. To use a server-side scripting language, like PHP or ASP
3. To use SQL to get the data you want.
4. To use HTML/CSS to style the page.
Importance of SQL
1. Create role in database management.
2. Used in various applications, web development, data
analysis, business intelligence.
3. Enables efficient and secure data retrieval.
4. Integration with programming language.
5. Compatibility and Standardization.
Basic SQL Concepts
- Relational Database.
- Tables, Rows, and Columns.
- Primary and Foreign Keys.
- Indexes.
- Data Types.
Table Name: Students
ID |
Name |
Marks |
1 |
Mohamed |
90 |
2 |
Omar |
80 |
3 |
Hussein |
90 |
SQL syntax Rules
1. SQL statements must end with semicolons.
2. A single SQL statement does not require semicolons.
3. SQL statements are case-insensitive.
4. Identifiers must be enclosed with double quotes (or back
ticks in MySQL) if they have the same names as keywords to avoid clashes.
5. SQL statements can consist of one or more clauses, but the order should be correct.
Data definition language
- DDL: is used for defining and managing the structure of the database. It deals with database schema and the organization of data.
- Operations: creating, altering, and deleting database objects such as tables, views, indexes, and schemas.
- Example: Create table, alter table, drop table, create index.
Summary
In this tutorial, we introduced the basics of SQL and databases. You learned what a database is, why SQL is important, and how to use the most common SQL commands such as SELECT, INSERT, UPDATE, and DELETE with simple examples. These are the foundation of working with any relational database system like MySQL, PostgreSQL, or SQL Server. Mastering these basics is the first step toward becoming confident in database management and query writing. As you practice, you’ll discover that SQL is not only powerful but also easy to use once you understand its logic.
Conclusion: Learning SQL is the first and most
important step toward understanding how modern databases work. In this
tutorial, you explored the core concepts of databases, discovered why SQL is
essential, and practiced the most common commands such as SELECT, INSERT,
UPDATE, and DELETE. These basics give you the foundation to start building and
managing real-world databases
0 Comments