Tables, Rows, and Columns Explained
Key Concepts
- Tables
- Rows
- Columns
Tables
A table is a structured set of data organized into rows and columns. It serves as a container for storing related data in an organized manner. Each table has a unique name and is composed of rows and columns, which together define the structure and content of the data.
Rows
Rows, also known as records or tuples, represent individual entries or instances within a table. Each row contains a set of related data points that correspond to the columns of the table. For example, in a table representing customers, each row would represent a single customer with attributes like name, address, and phone number.
Columns
Columns, also known as fields or attributes, define the type of data that is stored in the table. Each column has a specific data type and represents a single characteristic or property of the data. For instance, in a customer table, columns might include "CustomerID," "Name," "Address," and "PhoneNumber."
Examples and Analogies
Consider a spreadsheet: a table is like a single sheet in the spreadsheet, rows are the horizontal lines of data, and columns are the vertical lines of data. Each cell in the spreadsheet represents a specific data point defined by its row and column.
Another analogy is a library catalog: a table is the entire catalog, rows are individual entries for each book, and columns are the categories like title, author, and publication date.
HTML Example
Below is an example of how tables, rows, and columns are represented in HTML:
CustomerID | Name | Address | PhoneNumber |
---|---|---|---|
1 | John Doe | 123 Main St | 555-1234 |
2 | Jane Smith | 456 Elm St | 555-5678 |