Middle
Physical structure — specify data types and constraints.
sobes.tech AI
Answer from AI
The physical structure of a database describes specific data types and constraints for tables and columns that ensure integrity and optimization.
Example:
- Data types: INT, VARCHAR(255), DATE, BOOLEAN, DECIMAL(10,2)
- Constraints:
- PRIMARY KEY — a unique identifier for a record
- FOREIGN KEY — a reference to another table to ensure connectivity
- NOT NULL — a mandatory field
- UNIQUE — uniqueness of the value in the column
- CHECK — validation of the value based on a condition
For example, a users table:
| Field | Data Type | Constraints |
|---|---|---|
| id | INT | PRIMARY KEY, NOT NULL |
| username | VARCHAR(50) | UNIQUE, NOT NULL |
| VARCHAR(100) | UNIQUE, NOT NULL | |
| created_at | TIMESTAMP | NOT NULL |
This description helps understand how data will be stored and what rules are applied for their correctness.