Databases questions

By Interwoven Maths

Databases question collection

Review Databases questions for Computer Science, with correct answers shown and coverage across tables, records and fields; primary keys; queries and criteria.

Back to Databases practice Back to Computer Science

Question 1

What is a database?
  1. An organised collection of related data
  2. A single unstructured data file
  3. A program that displays one record
  4. A network that transfers data

Question 2

What is a record in a database table?
  1. Row in a table
  2. Column in a table
  3. Query in SQL
  4. Form in an app

Question 3

What is a field in a database table?
  1. Column in a table
  2. Row in a table
  3. Table relationship
  4. Primary key

Question 4

Which property must a primary key have?
  1. A unique value for every record
  2. A repeated value in related records
  3. A text value in every record
  4. A value copied from a foreign key

Question 5

What is a foreign key used for?
  1. Linking a record to another table
  2. Uniquely identifying every record in its table
  3. Sorting records by one field
  4. Checking a value against a range

Question 6

In SQL, which command retrieves data?
  1. SELECT
  2. UPDATE
  3. DELETE
  4. INSERT

Question 7

In SQL, which clause filters rows?
  1. WHERE
  2. ORDER BY
  3. FROM
  4. JOIN

Question 8

What is ORDER BY used for in SQL?
  1. Sort results
  2. Delete results
  3. Count fields
  4. Create tables

Question 9

What ordering does ASC specify?
  1. Lowest to highest
  2. Highest to lowest
  3. Newest to oldest
  4. Reverse alphabetical

Question 10

What ordering does DESC specify?
  1. Highest to lowest
  2. Lowest to highest
  3. Oldest to newest
  4. Alphabetical order

Question 11

What does WHERE YearGroup = 10 do in an SQL query?
  1. Selects records for Year 10
  2. Sorts records by year group
  3. Changes every year group to 10
  4. Adds a new Year 10 record

Question 12

Which clause sorts pupils alphabetically by surname?
  1. ORDER BY Surname ASC
  2. ORDER BY Surname DESC
  3. WHERE Surname = 'ASC'
  4. SELECT ASC(Surname)

Question 13

Which SQL command adds a new record to a table?
  1. INSERT INTO
  2. UPDATE
  3. DELETE FROM
  4. ORDER BY

Question 14

What does AND mean in an SQL condition?
  1. Both conditions must be true
  2. Either condition can be true
  3. No condition is checked
  4. Rows are sorted descending

Question 15

When is an SQL condition joined by OR true?
  1. When at least one condition is true
  2. Only when both conditions are true
  3. Only when exactly one condition is true
  4. When both conditions are false

Question 16

What does INSERT INTO do?
  1. Adds new records
  2. Changes existing records
  3. Removes existing records
  4. Retrieves matching records

Question 17

What is UPDATE used for in SQL?
  1. Change existing records
  2. Creating a database
  3. Delete a table
  4. Count all rows

Question 18

What is DELETE used for in SQL?
  1. Remove records
  2. Add records
  3. Encrypt records
  4. Sort records

Question 19

Which field is the best primary key for a Customers table?
  1. CustomerID
  2. Surname
  3. Town
  4. DateOfBirth

Question 20

Which field in Orders should link each order to Customers?
  1. CustomerID
  2. OrderDate
  3. Quantity
  4. DeliveryTown

Question 21

Which query removes pupil 42 without deleting other pupils?
  1. DELETE FROM Pupils WHERE PupilID = 42
  2. DELETE FROM Pupils
  3. UPDATE Pupils WHERE PupilID = 42
  4. DELETE PupilID = 42 FROM Pupils

Question 22

What is an entity in database design?
  1. A real-world object stored as data
  2. One property stored in a field
  3. One row returned by a query
  4. A rule that validates input

Question 23

Which SQL keyword names the table used by a SELECT query?
  1. FROM
  2. WHERE
  3. ORDER BY
  4. UPDATE

Question 24

Which example is a one-to-many relationship?
  1. One customer placing several orders
  2. One pupil having one candidate number
  3. Several pupils joining several clubs
  4. Several doctors treating several patients

Question 25

What does a database field's data type specify?
  1. The kind of value it can store
  2. Whether its value must be unique
  3. Which table it links to
  4. How its records are sorted

About this topic

Review Databases questions for Computer Science, with correct answers shown and coverage across tables, records and fields; primary keys; queries and criteria.

This topic covers

Example question types