Tables, Rows, and Columns
What you'll learn: How relational databases organize data into tables where rows represent individual records and columns represent attributes with specific types.
The Spreadsheet Analogy
Think of a database table like a spreadsheet you might use in Excel or Google Sheets. Just as a spreadsheet has a grid structure, database tables organize information in a similar way—but with much stricter rules and powerful query capabilities.
Tables as Relations
In the relational model, a table (also called a relation) is the fundamental structure for storing data. Each table represents a specific type of entity—like customers, products, or orders.
Rows: Individual Records
Each row (also called a tuple or record) in a table represents one complete instance of that entity. For example, in a Customers table, each row would represent one specific customer with all their information.
If you have 100 customers, your table has 100 rows.
Columns: Attributes with Domains
Each column (also called an attribute or field) represents a specific piece of information that describes the entity. Every column has:
- A name (like
CustomerID,FirstName,Email) - A domain (the data type and valid values it can hold)
The domain defines what kind of data belongs in that column—for example, the Age column might only accept integers between 0 and 150, while the Email column accepts text strings formatted as email addresses.
The Structure in Action
Imagine a Products table:
- Each row = one product (a laptop, a mouse, a keyboard)
- Each column = one property (ProductID, Name, Price, StockQuantity)
- Each cell contains a value that respects that column's domain rules
Key Takeaway: Database tables organize data as rows (records) intersecting with columns (attributes), where each column enforces specific domain constraints on the values it can contain.