In the context of a relational database table, a column is a set of data values of a particular simple type, one for each row of the table. The columns provide the structure according to which the rows are composed.
The term field is often used interchangeably with column, although many consider it more correct to use field (or field value) to refer specifically to the single item that exists at the intersection between one row and one column.
In relational database terminology, column's equivalent is called attribute.
For example, a table that represents companies might have the following columns:
- ID (integer identifier, unique to each row)
- Name (text)
- Address line 1 (text)
- Address line 2 (text)
- City (integer identifier, drawn from a separate table of cities, from which any state or country information would be drawn)
- Postal code (text)
- Industry (integer identifier, drawn from a separate table of industries)
- etc.
Each row would provide a data value for each column and would then be understood as a single structured data value, in this case representing a company. More formally, each row can be interpreted as a relvar, composed of a set of tuples, with each tuple consisting of the two items: the name of the relevant column and the value this row provides for that column.
Column 1 | Column 2 | |
---|---|---|
Row 1 | Row 1, Column 1 | Row 1, Column 2 |
Row 2 | Row 2, Column 1 | Row 2, Column 2 |
Row 3 | Row 3, Column 1 | Row 3, Column 2 |
Examples of database: MySQL, SQL Server, Access, Oracle, Sybase, DB2.
Coding involved: SQL
See more at SQL.
Famous quotes containing the word column:
“When the landscape buckles and jerks around, when a dust column of debris rises from the collapse of a block of buildings on bodies that could have been your own, when the staves of history fall awry and the barrel of time bursts apart, some turn to prayer, some to poetry: words in the memory, a stained book carried close to the body, the notebook scribbled by handa center of gravity.”
—Adrienne Rich (b. 1929)