Databases are systems designed to store, organize, and manage data efficiently, enabling users and applications to retrieve, update, and analyze information.
Query Processing
When a user submits a query (e.g., SELECT * FROM Users WHERE age > 30), the DBMS:
- Parses & Validates: Checks syntax and table/column existence.
- Optimizes: Generates the most efficient execution plan (e.g., choosing indexes or join order).
- Executes:
- Reads data from disk/memory.
- Applies filters, joins, and aggregations.
- Returns results to the user.
Example Query Workflow:
SELECT name FROM Users WHERE country = 'USA' ORDER BY name;
- Steps:
- Scan the
Users
table. - Filter rows where
country = ‘USA’
. - Sort results by
name
. - Return the
name
column.
- Scan the