Table, Record, Field and Key Basics

Table, Record, Field and Key Basics. Foundational Computer Awareness explanations, examples and explained practice questions for banking and recruitment exam preparation.

By Akhilesh Saini

Learning objectives

Identify how a relational table is organized, use row/column terminology correctly, and explain primary, foreign, candidate and composite keys at beginner level.

A table is an organized set of rows and columns

In a relational database, a table represents one kind of entity or relationship. A Customers table could store customer records, while an Accounts table stores accounts. The following is a fictional teaching example, not real banking data:

Customers

customer_idcustomer_namecity
C101MiraPune
C102RaviJaipur
C103NoorKochi

The entire structure is a table. customer_id, customer_name and city are columns, also called fields or attributes at this level. Each horizontal entry is a row, also called a record or tuple. The individual value Pune in Mira's row is a field value. In a more formal relational model, the concepts have precise mathematical definitions, but the row/column terminology is sufficient for these exams.

Table rows and columns with a customer primary key referenced by an account foreign key.
Table anatomy: record, field, primary and foreign keys

Why does a row need a key?

If two people are named Mira, searching or updating by name alone may select the wrong person. A key is one or more attributes used to identify rows or relate them to other rows. The fictitious customer_id values distinguish the three records even if names repeat.

A primary key is the chosen key that uniquely identifies each table row. Its values must be unique and not NULL in an appropriately defined relational table. A customer identifier is a typical primary-key example. The words primary key describe a constraint/role; the name of a real table's key may be anything.

A foreign key is a field or combination of fields that references a candidate/primary key (or otherwise eligible unique key) of another or sometimes the same table. It helps establish and enforce a relationship. For example:

Accounts

account_idcustomer_idaccount_type
A501C101Savings
A502C102Current
A503C101Fixed deposit

Here account_id is the primary key of Accounts. customer_id is a foreign key referring to Customers.customer_id. The two rows referring to C101 are fine: a foreign key may repeat when many accounts refer to one customer. Under a simple enforced foreign-key rule, C999 would be rejected if no matching customer existed. Whether NULL is permitted depends on the column's nullability and relationship design.

Important key terminology

Key termExplanationSimple example
Primary keySelected unique row identifiercustomer_id in Customers
Foreign keyReference to an eligible key in a related tablecustomer_id in Accounts
Candidate keyMinimal set of attributes that can uniquely identify a rowCustomer ID; a truly unique alternate reference, if enforced
Alternate keyCandidate key not selected as the primary keyAnother unique identifier, when defined
Composite keyA key involving more than one column(account_id, statement_period) in an illustrative summary table
Unique constraintRule preventing duplicate values (NULL handling varies by DBMS)An enforced unique reference code

Superkey, if encountered, means a set of attributes that uniquely identifies rows; it may contain extra, unnecessary attributes. A candidate key is minimal. This distinction is optional awareness vocabulary, not an invitation to study functional-dependency theory here.

NULL is not zero or a blank word

NULL commonly means an absent, unknown or inapplicable value. It is not the same as numerical 0, the empty string '', or the printed word "NULL". A key rule and a NOT NULL constraint can prevent missing identifiers. Exact uniqueness and NULL behavior can vary across products, so introductory exams usually focus on the plain conceptual distinction.

Why use sensible data types?

An amount may be a numeric/decimal value, a date may use a date-type representation and a leading-zero reference such as "0017" may need to remain text. Different databases support different exact type names. A key that looks numeric is not necessarily suitable for arithmetic.

Common confusions and exam traps

  • Row/record/tuple point to one entry; column/field/attribute point to one property.
  • Primary key must be unique; a typical foreign key can repeat.
  • A foreign key is not automatically the primary key of its own table.
  • Two similarly named columns do not establish a relationship automatically; the database relationship must be designed and, for enforcement, defined.
  • A composite key has multiple columns; it is not a key containing a long text string.
  • NULL does not mean zero and can require special treatment in queries.

Worked example: choose the right key

A branch records multiple requests from the same customer. Using customer_id alone as the primary key of the Requests table would prevent multiple requests for one customer. A request_id can uniquely identify each request, while customer_id remains a foreign key back to Customers. The design matches what each row represents.

Objective-exam facts to remember

Recognition clueAnswer
Horizontal entryRow/record/tuple
Vertical propertyColumn/field/attribute
One intersectionCell value / field value
Unique selected identifierPrimary key
Reference to another tableForeign key
Key involving two or more attributesComposite key
Missing or unknown field valueNULL

Quick revision

  1. A table contains rows and columns; a record is a row.
  2. A field is a column, while one field value belongs to a particular row.
  3. A primary key uniquely identifies a row and cannot be NULL.
  4. Foreign keys support relationships and may repeat in a one-to-many relationship.
  5. Candidate keys are minimal potential identifiers; composite keys use multiple fields.

Practice questions — CA-08-02

1. A horizontal entry in a relational table is commonly called a:
A. Column
B. Record/row
C. Constraint
D. Data type

2. The vertical property city in a Customers table is a:
A. Row
B. Transaction
C. Column/field
D. Complete database

3. A primary key is chosen mainly to:
A. Uniquely identify table rows
B. Format the printed page
C. Start a Wi-Fi connection
D. Encrypt every file automatically

4. Which statement about primary-key values is correct?
A. They should always be decimal amounts
B. They must repeat in every row
C. They are always passwords
D. They must be unique for the key and not NULL

5. A foreign key commonly:
A. Sets the computer clock
B. Refers to an eligible key in a related table
C. Is always the same as a table name
D. Requires exactly one row in every table

6. In the example Accounts table, two rows may use customer_id = C101 because:
A. C101 is a database password
B. Primary keys have no rules
C. A foreign key may repeat in a one-to-many relationship
D. All rows are duplicates

7. A key consisting of (account_id, period) is called a:
A. Composite key
B. Browser key
C. Encryption-only key
D. Single-field key

8. A candidate key is best described as:
A. Any column containing text
B. A URL path
C. An index used only for sorting
D. A minimal set of fields capable of uniquely identifying a row

9. In database terminology, NULL most often represents:
A. Integer zero
B. A missing, unknown or inapplicable value
C. A stored space character
D. The number one

10. The entry Pune in Mira’s city column is a:
A. SQL program
B. Entire table
C. Field value
D. Primary-key constraint

11. What is the best primary key for a Requests table allowing many requests from one customer?
A. Unique request_id
B. customer_name only
C. customer_id alone in every case
D. Any city name

12. Which distinction is correct?
A. Field is always a whole row
B. Record and column mean identical things
C. Primary key must be an integer
D. Row/record is an entry; column/field is a property

Answers and explanations — CA-08-02

1. B — Record/row. A row or record represents one entry; a column is a property across many entries.

2. C — Column/field. A column, also called a field or attribute at awareness level, defines a property of each row.

3. A — Uniquely identify table rows. Its purpose is reliable row identification; it must uniquely identify a row and cannot contain NULL.

4. D — They must be unique for the key and not NULL. Primary-key constraints require unique, non-NULL values for the chosen identifying fields.

5. B — Refers to an eligible key in a related table. A foreign key records a relationship by referencing values of an eligible parent key.

6. C — A foreign key may repeat in a one-to-many relationship. Different accounts may belong to the same customer, so the child-side foreign-key value can repeat.

7. A — Composite key. A composite key uses more than one column together to identify or link records.

8. D — A minimal set of fields capable of uniquely identifying a row. A candidate key is a minimal identifier; one of the candidates may be selected as the primary key.

9. B — A missing, unknown or inapplicable value. NULL indicates absence or unknown/inapplicable information and differs from zero and empty text.

10. C — Field value. It is the value of one field in one row, not the definition of the column itself.

11. A — Unique request_id. A distinct request identifier can identify each request while customer_id may repeat as a foreign key.

12. D — Row/record is an entry; column/field is a property. Row and column refer to different dimensions of tabular data, regardless of the specific data types.