Computer Science · High School (9–10) · 3 courses, 30 worked problems, 30 practice questions
A database stores data in an organised way so that it can be searched quickly. In a single-table database, each row is a record, such as one student, and each column is a field, such as a name or a date of birth. Each field has a data type, and the primary key is a field that is unique for every record. SQL is the language used to ask questions of a database. A query such as SELECT name FROM students WHERE age > 15; picks out the records you need. ORDER BY sorts them, and SUM and COUNT give totals.
SELECT, FROM and WHEREORDER BY, SUM and COUNTChoose an answer, then check it. Each one shows a full explanation.
A club table keeps one row for each member. What do we call the row that holds every detail about one member?
A park keeps a table Trees with the fields TreeID, Species, HeightM and Planted. There is one row for each of the 9 trees in the park. How many records and how many fields does the table have?
A field Wheelchair records whether a seat in a theatre has space for a wheelchair. Which data type suits it best?
Each one has a hint, the key idea and a full worked solution.
A field Grade always holds exactly one letter, from A to E. Which data type suits it best?
A field Mobile stores phone numbers such as +33 6 12 34 56 78. Which data type should it have, and why?
A cycle club stores its bikes in a table. The fields are FrameNo, Colour, Owner and Gears. The records are (FR8841, Red, Kofi, 21), (FR2093, Blue, Ana, 7), (FR5520, Red, Lee, 21) and (FR7716, Green, Ana, 3). Which field is the most suitable primary key?
A field Percentage must hold a whole number from 0 to 100. A clerk types 140. Which validation check rejects it?
A field ClassCode must be two capital letters followed by two digits, such as KT48. Which validation check makes sure each code follows this pattern?
A youth club takes members aged from 16 to 19 years. A tester picks ages to try on the range check: both limits, and one age just beyond each limit. Which choice is right?
A table Results has the fields StudentID, Subject and Mark. The records are (S1, Maths, 72), (S1, Art, 64), (S2, Maths, 58) and (S3, Art, 72). Which of these is true?