A Database Attribute Defines the Properties of a Table

Attributes are like Characteristics

A database attribute is simply a column name in a table in a database.

A database is comprised of tables. Each table has columns and rows; the columns in a database are called database ​attributes. 

This makes sense when you think of it, given that the non-technical definition of an attribute is that it defines a characteristic or quality of something. 

Attributes Describe Entities

Let's consider a database developed by a business.

It likely includes tables  ​— also called entities to database designers — for Customers, ​Employees and Products, among others. The Products table defines the characteristics of each product. These might include a product ID, a product name, a supplier ID (used as a foreign key), a quantity and a price. Each of these characteristics is an attribute of the entity (or table) named Products.

Consider this snippet from the commonly-cited Northwinds database:

ProductIDProductNameSupplierIDCategoryIDQuantityPerUUnitPrice
1Chai1110 boxes x 20 bags18.00
2Chang1124 - 12 oz bottles19.00
3Aniseed Syrup1212 - 550 ml bottles10.00
4Chef Anton's Cajun Seasoning2248 - 6 oz jars22.00
5Chef Anton's Gumbo Mix2236 boxes21.35
6Grandma's Boysenberry Spread3212 - 8 oz jars25.00
7Uncle Bob's Organic Dried Pears3712 - 1 lb pkgs.30.00

 

 

 

 

 

 

The column names are the attributes of a product. 

Is an Attribute a Field?

Sometimes, the term field and attribute are used interchangeably, and for most purposes, they are the same thing.

However, a field is usually used to describe a particular cell in a table found on any row, while an attribute is generally used to described an entity characteristic in a design sense. For example, in the table above, the ProductName in the second row is "Chang." This is a field.  But if you are discussing products in general, the ProductName is the product's column.

This is the attribute.

Don't get hung up on this, however: often, these two terms are used interchangeably.

Defining Attributes

Attributes are defined in terms of their domain. A domain defines the allowable values that this attribute can contain. This could include its data type, length, values and other details.

For example, the domain for an attribute ProductID might specify a numeric data type. The attribute can be further defined to require a specific length, or whether an empty or unknown value is allowed.