Relational Models
Database Models
Â
Data Structure:
A data structure refers to how data is organized and stored in a database. This typically involves tables, rows, columns, and indexes. In a relational database model, data is structured in a tabular format with rows and columns. Each table (relation) represents a specific entity, columns represent attributes, and rows represent records. Other database models like hierarchical, network, or graph databases have different data structures.
Operations:
Operations are the actions that are allowed on the data within the database. They include basic operations like creating, reading, updating, and deleting records (often abbreviated as CRUD operations). Other operations include sorting, filtering, aggregating, joining, indexing, and more.
In SQL (Structured Query Language), these operations are performed using commands such as INSERT (to create data), SELECT (to read data), UPDATE (to modify data), DELETE (to remove data), and more complex queries that involve JOIN (to combine tables), ORDER BY (to sort data), GROUP BY (to aggregate data), etc.
Rules (or Constraints):
Rules, also known as constraints, enforce certain conditions that the data in the database must comply with. They ensure the accuracy and reliability of the data. Some common constraints include:
Primary Key Constraint: Ensures that a column (or set of columns) has a unique value and no null values. It uniquely identifies each record in a table.
Foreign Key Constraint: Ensures that the value in a column (or set of columns) matches the values in the primary key column of another table. It is used to prevent actions that would destroy links between tables.
Unique Constraint: Ensures that all values in a column (or set of columns) are unique across the dataset.
Not Null Constraint: Ensures that a column cannot have null values.
Check Constraint: Ensures that all values in a column satisfy certain conditions.
This high-level structure helps ensure that the database can effectively support the business processes it is intended to model, ensuring data integrity, accuracy, and consistency.