A table in a database is a structured collection of related data organized into rows and columns, where each row represents a unique record and each column represents an attribute of the data.
A table is the fundamental building block of a relational database. It consists of multiple columns (fields) that define the type of data stored and multiple rows (records) that hold individual data entries. Each table is uniquely identified by a name and can have constraints to ensure data integrity.
For example, in a student management system, a table named Students
can have columns like student_id
, name
, age
, and course
. Each row in this table represents a different student.
Tables can be linked to other tables using primary keys and foreign keys, allowing databases to maintain relationships between different data entities efficiently.
CREATE TABLE Students (
student_id INT PRIMARY KEY,
name VARCHAR(100),
age INT,
course VARCHAR(50)
);
This creates a Students
table with three attributes: student_id
, name
, and age
.
Leave a Reply