Table
In one line
A table is a structure in a relational database that holds data in rows and columns — like a spreadsheet with strict rules.
In simple words
A table is the fundamental storage unit in a relational database. It has a name, a set of columns (each with a data type), and zero or more rows of data. Each column defines what kind of data it holds — text, numbers, dates, booleans.
Think of a table as a very strict spreadsheet. Every row must have a value (or NULL) for every column, and every value must match the column's data type. You cannot put text into an integer column.
For example, a products table might have columns id (integer), name (text), price (numeric), and in_stock (boolean). Each row represents one product.
Example
CREATE TABLE products (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
price NUMERIC(10, 2) NOT NULL,
in_stock BOOLEAN DEFAULT TRUE
);
INSERT INTO products (name, price) VALUES ('Widget', 9.99);This creates a products table with four columns and inserts one row.
Related terms
Related Resources
Related Lessons
- Tables
Learn how to create and manage tables.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.