Marcia has taught Information technology and Mathematics with a master's degree in IT
Explore how and what an attribute in a relational database is in this lesson. In database management systems, it refers to a table within the database. In relational databases, it refers to a column within the table.
The Need for Databases
Have you ever imagined a world in which there are no databases? Say you were at the airport, standing in line to get a flight, but the clerk has to look up any available seats from a huge book of paper or call someone to find out if a flight is available. This is why we have designed relational databases and the components within database tables.
Relational databases are electronic tables that look like spreadsheets and house large amounts of interconnected data. They are make of up of rows and columns. The rows are called tuples, which are data sets that apply to one item. The columns are called attributes, which are the describing characteristics of each tuple, such as customers, flights, or suspects. Think of describing a person that committed a burglary to the police. You want to include their height, weight, eye color, race, and hair color. These would be important characteristics that help to identify the person.
The tables are connected to each other by use of a primary key, or a special column in the database table that describes all the records uniquely. Think of an airport in which you have a list of flights. The flight number is the primary key.
If we look at the table of flights with the primary key of flight number, we want to describe any object or data about the flight number. Corresponding attributes could be arriving time, arrival day, departing time, departure date, where it's departing and what city it will arrive in.
The corresponding table will look like this:
Example table with the unique flight number as the primary key, and the descriptive columns as attributes.
These are all characteristics that describe important elements about the flight number, the primary key. Even if you were to take two flights, each flight number would be unique for that particular air carrier.
Tables are designated as either strong or weak entities. A table that has only one primary key is considered a strong entity. If the table doesn't have a primary key, but has two attributes that only together comprise a unique identifier, that's called using a composite key. Say a table describes which event will happen in which room at a convention center, like this:
Over 79,000 lessons in all major subjects
Get access risk-free for 30 days,
just create an account.
The column of room # and room time are only unique when taken together. This forms a composite key.
Two attributes, room number and time, can have repeated information if only taken by themselves. But together they are unique to the set, as two events can't happen in the same room at the same time. Tables using a composite key are considered weak entities.
Attributes should be totally dependent on the primary key to provide what is called functional dependency. Functional dependency is reliant on all the attributes describing the primary key. No more and no less are needed to describe the table.
Let's imagine that we delete 'Arrival Time' from the flight table. That particular attribute is needed to fully describe the flight and when it will arrive. We have then destroyed the functional dependency. In other words, the table has been weakened without that attribute.
Remember, relational databases are electronic tables that describe the relationships between interconnected data. Each table is make of rows, or tuples, that include a data set about an individual item, and columns, or attributes that help to identify the primary key. The primary key is a special column in the database table that describes all the records uniquely.
A strong table has a primary key. A weak one would include a composite key, or two attributes that are only uniquely descriptive when taken together. Attributes should be totally dependent on the primary key to provide functional dependency, where the table is reliant on all the attributes describing the primary key.
Did you know… We have over 200 college
courses that prepare you to earn
credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the
first two years of college and save thousands off your degree. Anyone can earn
credit-by-exam regardless of age or education level.