1.6 KiB
TABLES
A database, often referred to as a schema in a relational context, is an organized collection of structured data. It's the persistence layer for your application, essential for storing and managing information that outlasts application processes.
Think of it as a reliable system ensuring data validity and enforcing relationships without requiring excessive application-level checks.
Tables and Columns
The fundamental unit of a database is the table. Tables organize data into rows and columns, similar in concept to a spreadsheet but with enforced structure and data types.
Each column within a table holds a specific type of data (e.g., text, numbers, dates), defining the structure for every entry.
Consider a simple task management application. Key information would reside in distinct tables:
- Users: Stores user-specific data. Columns might include
username,name, andactivestatus. - Tasks: Contains task details. Relevant columns could be
task_name,status,due_date, andpriority.
The Users table structure illustrates this:
| id | username | name | active |
|---|---|---|---|
| 1 | shinobi | Software Shinobi | true |
| 2 | grisi | Greisi I. | true |
| 3 | javateamsix | Java Team Six | false |
Table Structure Summary
- The table is defined by four columns:
id,username,name, andactive. - Each row represents a distinct record, with three entries (users) shown here.
- The
idcolumn serves as the unique identifier for each record, typically configured for automatic incrementing.