Docsity

Data bases, relational algebra, Appunti di Basi di Dati

Toggle sidebar
bg1
DATA BASES I
1. INTRODUCTION
a-Information Systems & Concepts
Information Systems: Networks of hardware and software
used to collect, store, process, and distribute data to support
decision-making. (Ex: Traditional (inventory, purchase
orders), financial (banking, stock exchanges), booking
platforms (airlines, hotels), and Web systems (e-commerce,
digital libraries).
Data vs. Information:
Data: Raw facts or unprocessed units (e.g., < 16/9/24,
13:30, 26.8 >).
Information: Processed data with applied
context/semantics to answer a query (
Data+Semantics=Information
).
b-File Systems vs. DBMS
File System Approach:
Applications store data in individual files (SAN, DAS, NAS,
Cloud).
Drawbacks: Redundancy, potential data inconsistencies,
and requires applications to know the internal file structure.
Database Management System (DBMS) Approach:
Centralized software layer managing a single source of data
for multiple applications.
Uses a data dictionary (catalog) to provide a unified data
structure and higher abstraction.
c-Key Characteristics & Benefits of a DBMS
Core Characteristics: Massive storage, Persistent data,
Safe access, Multi-user support, Convenient querying,
Efficient performance, and Reliable execution.
Main Advantages:
pf3
pf4
pf5

Anteprima parziale del testo

Scarica Data bases, relational algebra e più Appunti in PDF di Basi di Dati solo su Docsity!

DATA BASES I

1. INTRODUCTION

a-Information Systems & Concepts Information Systems: Networks of hardware and software used to collect, store, process, and distribute data to support decision-making. (Ex: Traditional (inventory, purchase orders), financial (banking, stock exchanges), booking platforms (airlines, hotels), and Web systems (e-commerce, digital libraries). Data vs. Information: Data: Raw facts or unprocessed units (e.g., < 16/9/24, 13:30, 26.8 >). Information: Processed data with applied context/semantics to answer a query ( Data+Semantics=Information). b-File Systems vs. DBMS File System Approach: Applications store data in individual files (SAN, DAS, NAS, Cloud). Drawbacks: Redundancy, potential data inconsistencies, and requires applications to know the internal file structure. Database Management System (DBMS) Approach: Centralized software layer managing a single source of data for multiple applications. Uses a data dictionary (catalog) to provide a unified data structure and higher abstraction. c-Key Characteristics & Benefits of a DBMS Core Characteristics: Massive storage, Persistent data, Safe access, Multi-user support, Convenient querying, Efficient performance, and Reliable execution. Main Advantages:

Data Sharing & Integration: Stored conceptually once (eliminates redundancy and waste). Consistency: Prevents contradictory data values. Data Quality & Security: Enforces integrity constraints and access control. d- Schema vs. Instance Schema: Structural description of the database (defined once). Instance: The actual data stored in the database at a specific point in time. e-DBMS Languages & Operations Data Definition Language (DDL): Defines and modifies the database schema (e.g., CREATE TABLE, ALTER, DROP). Data Manipulation Language (DML): Modifies the instance data (e.g., INSERT, UPDATE, DELETE). Query Language: Retrieves and filters stored data (e.g., SELECT ... FROM ... WHERE ...). f-Null Values Represent missing, unknown, undefined, or non-applicable data. Compatible with all data types (polymorphic). Distinct from standard values; helps handle uncertainty and incomplete information. g-DBMS User Roles Database Administrator (DBA): Defines structural models using DDL. Application Developers: Write application code and interaction routines using DML. Occasional Users: Execute ad-hoc queries via visual tools or query languages.

External Schema (Views): Tailored descriptions for specific user applications.  Logical Schema: Global description of the entire database structure.  Internal / Physical Schema: Low-level storage mechanisms managed via the OS file manager and disk drivers.  Key Benefits: o Logical Independence: Users see customized views without worrying about global changes. o Physical Independence: Applications remain unaffected by underlying storage or hardware modifications.

3. Relational Model: DefinitionsInformal Definition: Data is stored in tables (relations) consisting of rows (tuples) and columns (attributes/domains).  Formal Definition (Set Theory): o Based on Cartesian products (^ D^1 ×^ D^2 ×^ …×^ D^ n ). o A relation is a subset of a Cartesian product. o Degree: Number of attributes (columns). o Cardinality: Number of tuples (rows).  Positional vs. Non-Positional: Mathematical relations rely on domain positions, whereas relational model attributes have names, making positional ordering irrelevant. 4. Keys and Integrity ConstraintsKey Definition: A subset of attributes that is unique (no two tuples share the same values) and minimal (removing any attribute breaks uniqueness).  Types of Keys:

o Superkey: Any set of attributes containing a key (uniqueness satisfied, but not necessarily minimal). o Primary Key: The chosen primary identifier for a relation (cannot contain NULL values). o Secondary Keys: Alternative unique identifiers (e.g., email, SSN).  Dataset Quality: Enforcing constraints (keys, referential integrity, domain restrictions) ensures accurate and trustworthy data. Overview of Query LanguagesFormal Languages: Relational Algebra, Relational Calculus, Datalog.  Commercial Languages: SQL, Query By Example (QBE).  Algebra Closure: Operators generate new relations as output, allowing expressions to be safely composable.

2. Basic Operators (Unary & Binary)Selection (^ σ^ ): Filters tuples based on a boolean predicate (^ σ^ Condition (^ R^ )).  Projection ( Π ): Extracts specific columns and eliminates duplicates (^ Π^ Attributes (^ R^ )).  Union (^ ∪^ ), Intersection (^ ∩^ ), Difference ( −¿ ): Standard set operations requiring compatible schemas.  Cartesian Product ( × ): Combines every tuple of relation^ R^ with every tuple of relation^ S^ (^ R^ ×^ S^ ). 3. Derived OperatorsJoin (^ ⋈^ ): Combines related tuples from two relations based on a matching predicate (^ R^ ⋈^ Predicate S^ , defined as a selection over a Cartesian product).  Equi-Join: A join using strictly equality comparisons (¿).