Skip to content
BENIBIX Learn

Column

Development🗃️ DatabasesDatabase Basics

Also known as Field, Database Column, Attribute

One kind of fact every row holds, like name or price, with a set type.

Think of it like

Think of it like one box on a form, such as Name. Every form has it, and each person fills it in.

Example

Jack adds a phone column to his customers table. Each old row now has an empty phone until he fills it in.

Why it matters

Columns and their types are what keep data clean. A price can never be the word cheap.

Definition

A column is one kind of fact that every row in a table holds, like name or price. Each column has a name and a data type, such as text, number or date. The type stops wrong values, like a word in a price column. A column can also have rules, like NOT NULL, which means it may never be empty. Adding a column later changes the table for every row.

Example code

sql
ALTER TABLE customers ADD COLUMN phone TEXT;
Each row in customers now has a phone.

Common mistake

Storing a list in one column, like phone numbers split by commas. It becomes hard to search and keep right.

Key takeaways

  1. 1
    One kind of fact. Name, price or date.
  2. 2
    A set type. Wrong values are refused.
  3. 3
    Rules too. NOT NULL means never empty.