what is attribute in sql
Quick Scoop
In SQL, an attribute usually means a column in a table. It describes
one property of the entity stored in each row, like Name, Age, or Email.
Simple example
If you have a Students table:
StudentIDis an attribute.Nameis an attribute.DateOfBirthis an attribute.
Each row is one student, and each attribute stores one piece of information about that student.
Why it matters
Attributes help define:
- what data a table stores.
- what type of data each field can hold.
- rules like
PRIMARY KEY,UNIQUE, andNOT NULL.
Tiny SQL example
sql
CREATE TABLE Students (
StudentID INT PRIMARY KEY,
Name VARCHAR(100),
DateOfBirth DATE
);
Here, StudentID, Name, and DateOfBirth are the attributes, and their
data types control what values they can store.
If you want, I can also explain the difference between attribute, field, column, and entity in one short table.