Bird
Raised Fist0
DBMS Theoryknowledge~20 mins

Relations, tuples, and attributes in DBMS Theory - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Relations Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding the components of a relation

In a relational database, which of the following best describes a tuple?

AA key used to uniquely identify records
BA column in a table representing an attribute
CA single row in a table representing a record
DThe entire table containing all data
Attempts:
2 left
💡 Hint

Think about what a row in a table represents.

📋 Factual
intermediate
2:00remaining
Attributes in a relation

Which statement correctly defines an attribute in the context of a relation?

AAn attribute is a unique identifier for each tuple
BAn attribute is a property or column of a relation that describes data
CAn attribute is a set of tuples in a relation
DAn attribute is the physical storage location of data
Attempts:
2 left
💡 Hint

Attributes describe the characteristics of data stored in a table.

🔍 Analysis
advanced
2:00remaining
Counting tuples in a relation

Given a relation (table) with 5 attributes and 100 tuples, what is the total number of attribute values stored in the relation?

A100
B5
C105
D500
Attempts:
2 left
💡 Hint

Multiply the number of tuples by the number of attributes.

❓ Comparison
advanced
2:00remaining
Difference between relation and tuple

Which option correctly contrasts a relation and a tuple in a database?

AA relation is a set of tuples; a tuple is a single record within that set
BA relation is a single record; a tuple is a set of relations
CA relation is a column; a tuple is a row
DA relation is a key; a tuple is an attribute
Attempts:
2 left
💡 Hint

Think about the whole table versus one row.

❓ Reasoning
expert
2:00remaining
Uniqueness of tuples in a relation

In a relation, why must each tuple be unique, and what would happen if duplicate tuples were allowed?

ATuples must be unique to maintain data integrity; duplicates would cause ambiguity in queries
BTuples can be duplicated freely; duplicates improve query speed
CTuples must be unique to save storage space; duplicates waste memory
DTuples are unique only if the relation has a primary key; otherwise duplicates are ignored
Attempts:
2 left
💡 Hint

Consider how databases identify and retrieve records.

Practice

(1/5)
1. What does a tuple represent in a database relation?
easy
A. A key used to identify records
B. A column or attribute of the table
C. A single row or record in the table
D. The entire table itself

Solution

  1. Step 1: Understand the definition of a tuple

    A tuple is defined as a single row in a relation, representing one record.
  2. Step 2: Differentiate tuple from attributes and relation

    Attributes are columns, and the relation is the whole table, so tuple must be a row.
  3. Final Answer:

    A single row or record in the table -> Option C
  4. Quick Check:

    Tuple = row [OK]
Hint: Tuple means one row or record in a table [OK]
Common Mistakes:
  • Confusing tuple with attribute (column)
  • Thinking tuple is the whole table
  • Mixing tuple with keys
2. Which of the following correctly describes an attribute in a relation?
easy
A. A single row in the table
B. A column representing a data field
C. A key that uniquely identifies a tuple
D. A set of tuples in the table

Solution

  1. Step 1: Define attribute in the context of a relation

    An attribute is a column in a table that describes a data field.
  2. Step 2: Eliminate other options

    Rows are tuples, keys identify tuples, and sets of tuples form the relation, so only columns fit attribute.
  3. Final Answer:

    A column representing a data field -> Option B
  4. Quick Check:

    Attribute = column [OK]
Hint: Attribute means column in a table [OK]
Common Mistakes:
  • Confusing attribute with tuple (row)
  • Thinking attribute is a key
  • Mixing attribute with entire relation
3. Consider a relation with attributes (ID, Name, Age) and tuples:
(1, 'Alice', 30), (2, 'Bob', 25), (3, 'Carol', 27)
How many tuples and attributes does this relation have?
medium
A. 2 tuples and 3 attributes
B. 3 tuples and 2 attributes
C. 2 tuples and 2 attributes
D. 3 tuples and 3 attributes

Solution

  1. Step 1: Count the tuples (rows)

    There are three tuples: (1, 'Alice', 30), (2, 'Bob', 25), and (3, 'Carol', 27).
  2. Step 2: Count the attributes (columns)

    Attributes are ID, Name, and Age, so there are three attributes.
  3. Final Answer:

    3 tuples and 3 attributes -> Option D
  4. Quick Check:

    Tuples = 3, Attributes = 3 [OK]
Hint: Count rows for tuples, columns for attributes [OK]
Common Mistakes:
  • Counting attributes as tuples
  • Ignoring one tuple or attribute
  • Mixing up rows and columns
4. Identify the error in this relation definition:
Relation: Students(ID, Name, Age)
Tuples: (1, 'John'), (2, 'Jane', 22)
medium
A. Tuples have inconsistent number of attributes
B. Relation name is invalid
C. Attributes should be tuples
D. Tuples must be unique

Solution

  1. Step 1: Check tuple lengths against attributes

    The relation has 3 attributes, but the first tuple has only 2 values.
  2. Step 2: Confirm consistency requirement

    All tuples must have the same number of values as attributes; inconsistency is an error.
  3. Final Answer:

    Tuples have inconsistent number of attributes -> Option A
  4. Quick Check:

    Tuple length must match attributes [OK]
Hint: All tuples must match attribute count [OK]
Common Mistakes:
  • Ignoring tuple length mismatch
  • Thinking relation name is wrong
  • Confusing uniqueness with attribute count
5. You have a relation Employees(EmpID, Dept, Salary) with tuples:
(101, 'HR', 5000), (102, 'IT', 6000), (103, 'HR', 5500)
How would you describe the attribute Dept in terms of its role in the relation?
hard
A. It is an attribute representing the department column
B. It is a tuple representing employee data
C. It is a key uniquely identifying each employee
D. It is a relation containing employee records

Solution

  1. Step 1: Identify what Dept represents

    Dept is one of the columns describing employee data, so it is an attribute.
  2. Step 2: Differentiate from tuples and keys

    Tuples are rows, keys uniquely identify tuples, and relation is the whole table, so Dept is an attribute.
  3. Final Answer:

    It is an attribute representing the department column -> Option A
  4. Quick Check:

    Dept = attribute (column) [OK]
Hint: Attributes are columns describing data fields [OK]
Common Mistakes:
  • Confusing attribute with tuple (row)
  • Thinking Dept is a key
  • Mixing attribute with relation
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard