Column

A column in a database table represents a specific attribute or field of an entity, defining the type of data it can store and ensuring uniformity across all rows in the table.

A column specifies the type of data that can be stored in a table. Each column has a unique name and a defined data type, such as INTEGER, VARCHAR, or DATE. Columns help structure data so that all entries in a particular field follow a uniform format.

For instance, in an Employees table, columns could be employee_id, name, department, and salary. These columns define what kind of data can be stored for each employee.

Columns can also have constraints such as NOT NULL, UNIQUE, and DEFAULT to enforce rules on data entry.

Example SQL Query (Defining Columns with Constraints):

CREATE TABLE Employees (
    employee_id INT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    department VARCHAR(50),
    salary DECIMAL(10,2) DEFAULT 30000.00
);

Here, name cannot be NULL, and salary has a default value of 30000.00.