Free CompTIA ITF+ Database Fundamentals Questions and Answers — Questions and Answers
Question 1: In a relational database table for employees, what is the primary purpose of a 'EmployeeID' column that is designated as a primary key?
- To store the employee's full name for easy sorting.
- To link the employee table to an external spreadsheet.
- To uniquely identify each employee record in the table. (Correct answer)
- To count the total number of records in the table.
Correct answer: To uniquely identify each employee record in the table.
A primary key is a column (or a set of columns) in a table whose main purpose is to uniquely identify each record in that table. [27, 7] An 'EmployeeID' is a perfect candidate for a primary key because each employee will have a unique ID, ensuring no two records are identical and allowing for reliable data retrieval and relationships.
Question 2: A database contains a 'Products' table. All the information about a single product—its name, price, and stock quantity—is stored together. What is this complete set of information for one product called?
- A record (Correct answer)
- A field
- A schema
- A query
Correct answer: A record
A record, also known as a row, represents a single, complete entry in a table. [4, 28] It is a horizontal grouping of all the related data for one item. In this case, the name, price, and stock quantity for one specific product constitute a single record. [25]
Question 3: A developer needs to write a SQL statement to retrieve the names and email addresses of all customers from a 'Customers' table. Which of the following commands should be used to begin this query?
- UPDATE
- INSERT
- CREATE
- SELECT (Correct answer)
Correct answer: SELECT
The `SELECT` command is the fundamental SQL statement used to retrieve, or read, data from a database. [14, 24] `INSERT` is used to create new records, `UPDATE` modifies existing records, and `CREATE` is used to create new database objects like tables, not retrieve data from them. These operations are part of the CRUD (Create, Read, Update, Delete) model. [15]
Question 4: A small business owner is currently storing all customer and order information in a single spreadsheet. An IT consultant recommends moving to a relational database to reduce data redundancy and improve integrity. What is the primary advantage of a relational database over this flat file approach?
- It stores all data in a single, unstructured file for faster access.
- It uses multiple, linked tables to separate different types of data, such as customers and orders. (Correct answer)
- It is less secure and easier for any user to modify.
- It does not require a predefined structure for the data.
Correct answer: It uses multiple, linked tables to separate different types of data, such as customers and orders.
The core principle of a relational database is organizing data into multiple tables that are related to each other. [3, 30] For example, one table for customer information and another for order information. This is a significant advantage over a flat file (like a spreadsheet) where all data is in one place, often leading to repetition and inconsistencies. [19]
Question 5: A database has a 'Students' table with a primary key 'StudentID' and an 'Enrollments' table to track which courses students are taking. To link an enrollment record to a specific student, what should be added to the 'Enrollments' table?
- A database schema
- A secondary user account
- A new primary key named 'EnrollmentID'
- A foreign key that references the 'StudentID' from the 'Students' table (Correct answer)
Correct answer: A foreign key that references the 'StudentID' from the 'Students' table
A foreign key is a column in one table that refers to the primary key of another table. [7, 1] By placing the 'StudentID' in the 'Enrollments' table as a foreign key, a direct link is created between a specific student and their enrollment records, enforcing referential integrity. [13]
Question 6: Which of the following BEST describes a database schema?
- The blueprint that defines the database's structure, including its tables, fields, and relationships. (Correct answer)
- A software application used to query the database.
- A compressed backup file of the database's data.
- A single row of data containing all fields for one entry.
Correct answer: The blueprint that defines the database's structure, including its tables, fields, and relationships.
A database schema is the logical blueprint or framework of a database. [8, 12] It outlines the tables, the fields within those tables, the data types for each field, and the relationships between the tables, but does not contain the actual data itself. [11, 16]
In a relational database table for employees, what is the primary purpose of a 'EmployeeID' column that is designated as a primary key?