top of page
Writer's picturecompnomics

Understanding Database Terminology


When diving into the world of databases, it's essential to grasp the fundamental terminology. Here's a breakdown of some key concepts:


Tuple, Degree, and Attributes

  • Tuple: A tuple, also known as a record, is a row in a database table. It represents a single instance of data. For example, a row in a customer table containing information about a specific customer would be a tuple.

  • Degree: The degree of a relation (or table) is the number of attributes (columns) it contains.

  • Attributes: Attributes are the columns in a table. They represent the characteristics or properties of the data stored in the table. For instance, a customer table might have attributes like customer ID, name, address, and contact number.


Domain, Primary Key, Foreign Key, and Candidate Key

  • Domain: A domain defines the set of possible values that an attribute can take. For example, the domain of an "age" attribute might be integers between 0 and 120.

  • Primary Key: A primary key is a unique identifier for each tuple in a table. It ensures that every row is distinct. A primary key is typically a combination of attributes.

  • Foreign Key: A foreign key is a column in one table that references the primary key of another table. It establishes a relationship between the two tables. For example, an "order" table might have a foreign key referencing the "customer" table to indicate which customer placed the order.

  • Candidate Key: A candidate key is a set of attributes that uniquely identifies each tuple in a table. A table can have multiple candidate keys, but one of them is chosen as the primary key.


Example

Consider a simple customer table:

Customer ID

Name

Address

City

1

John Doe

123 Main St

New York

2

Jane Smith

456 Oak Ave

Los Angeles

  • Tuple: Each row in the table (e.g., the row with Customer ID 1) is a tuple.

  • Degree: The degree of the table is 4, as it has four columns (attributes).

  • Attributes: The attributes are Customer ID, Name, Address, and City.

  • Domain: The domain of the "Customer ID" attribute might be integers.

  • Primary Key: The "Customer ID" column is likely the primary key, as it uniquely identifies each customer.

  • Foreign Key: If there were an "order" table, it might have a foreign key referencing the "Customer ID" column in the customer table to associate orders with customers.

32 views0 comments

Recent Posts

See All

Kommentare

Mit 0 von 5 Sternen bewertet.
Noch keine Ratings

Rating hinzufügen
bottom of page