Skip to content
Marlbridge

Flashcards · 2210 · Topic 9

Databases flashcards

8 cards on Topic 9. Pick a subtopic or study them all.

Study mode needs JavaScript. Every card is listed below, so you can still cover the answers and test yourself.

All 8 cards

For a quick read-through or printing. Cover the right-hand side to test yourself.

Topic 9: Databases

What is a single-table (flat-file) database?
A database in which all the data is held in one table of records and fields.
Fields run down or across a table, and what about records?
Fields are the columns, each holding one kind of data. Records are the rows, each holding all the data about one item.
How do you rule out a field as the primary key?
Look for repeated values in the data. A field such as a surname, where two records share a value, cannot identify one record on its own.
Which data types would you choose for WeightKg, Vaccinated, Species and Visits?
WeightKg: real. Vaccinated: Boolean. Species: text. Visits: integer.
Write SQL to list PetName and OwnerSurname of every dog in table Pet
SELECT PetName, OwnerSurname FROM Pet WHERE Species = 'Dog';
How do you list results with the largest value first in SQL?
Add ORDER BY the field followed by DESC. ORDER BY sorts in ascending order unless DESC is added.
What do SUM and COUNT return in an SQL query?
SUM returns the total of the values in a numeric field for the selected records. COUNT returns the number of records that meet the WHERE condition.
When are quotation marks needed in an SQL condition?
Around a text value, e.g. Species = 'Dog'. Numbers are written without quotation marks, e.g. WeightKg > 20.