chapter 4 Introduction to Database
chapter 4 Introduction to Database
Chapter 4
What is Database?
What is a Database?
A database is a structured collection of data that is organized and
stored in a way that allows for efficient retrieval, management, and
manipulation of that data.
Databases are used to store, retrieve, and manage vast amounts of
information in various fields, including business, science, healthcare,
and more.
What is Database?
• A candidate key is an attribute, or set of attributes, that can be used to uniquely identify an
occurrence of the entity.
• The primary key is chosen from the set of candidate keys and is used to identify an entity
occurrence.
The primary key must guarantee the uniqueness of an entity occurrence.
1. The value of any component of the primary key cannot be null.
SQL
SELECT column1, column2
FROM table
WHERE condition;
Each SQL command has its own unique syntax, but they generally
include keywords like SELECT, FROM, WHERE, VALUES, SET, and
other.
Examples of Basic SQL Queries:
SELECT Query:
SELECT first_name, last_name
FROM employees
WHERE department = 'IT';
INSERT Query:
INSERT INTO customers (customer_id, customer_name, city)
VALUES (1, 'ABC Company', 'New York');
UPDATE Query:
UPDATE products
SET price = price * 1.1
WHERE category = 'Electronics';
Examples of Basic SQL Queries:
DELETE Query:
DELETE FROM orders
WHERE order_date < '2023-01-01';
Query Optimization
Enhancing Performance
Query optimization is a critical aspect of database administration
aimed at improving the speed and efficiency of queries. Optimized
queries contribute to better overall database performance, ensuring
that data retrieval and manipulation tasks are executed in the most
efficient manner.
Search Specifications