A column represents a specific attribute or field of information in a database table. Each column normally has a name and a data type. For example, an Employees table may have EmployeeName for names, Department for department information, Salary for numeric salary values, and JoiningDate for dates. Every row contains a value for each applicable column.
SQL queries frequently work with individual columns. You select columns using SELECT, filter them using WHERE, sort them using ORDER BY, group them using GROUP BY, and perform calculations using numeric columns. Understanding columns is therefore essential for writing useful queries.
If an Employees table has EmployeeName, Department, Salary, and Location columns, EmployeeName stores names, Department stores department information, Salary stores salary values, and Location stores employee locations.
SELECT
EmployeeName,
Department,
Salary
FROM Employees;
Columns represent business attributes such as customer name, account number, transaction amount, product category, employee salary, sales amount, order date, and branch location.
- A column represents an attribute.
- Columns have names.
- Columns normally have a data type.
- Each row contains values for columns.
- SQL queries frequently reference columns.
- Good column design improves data quality.
What is a column?
A column represents a specific attribute or field of information stored in a database table.
What is the difference between a row and a column?
A row represents one complete record, while a column represents one type of attribute shared by the records.