SHS Computing · Year 2
Relational Databases and SQL practice questions
Relational and NoSQL databases, tables, fields, records, entities and attributes, one-to-many and many-to-many relationships, primary, foreign and composite keys, referential integrity, schema design with data types and constraints (NOT NULL, UNIQUE, CHECK, FOREIGN KEY), and SQL statements and clauses: SELECT, INSERT, UPDATE, DELETE, WHERE, ORDER BY, GROUP BY, JOIN and aggregate functions.
23 questions in this topic: 3 recall, 6 applying skills and concepts, 12 strategic thinking and 2 extended thinking. Every one carries a written explanation.
Sample questions
3 of 23 questions in this topic. Sign up to answer them and see the explanations.
- Question 1Strategic thinking
Referential integrity prevents which problem?
- aTwo customers with exactly the same first name in the table
- bA product price written with two decimal places
- cA table with more rows than columns in it
- dAn order that refers to a customer who does not exist
- Question 2Strategic thinking
A Sales table has rows (Bread, 10), (Water, 4), (Bread, 10) and (Water, 4) as Item and Amount. What does SELECT Item, SUM(Amount) FROM Sales GROUP BY Item give for Bread?
- a10
- b28
- c20
- d2
- Question 3Strategic thinking
Which constraint best ensures that StockQuantity can never be negative?
- aStockQuantity NOT NULL
- bCHECK (StockQuantity >= 0)
- cUNIQUE (StockQuantity)
- dDEFAULT 0 on StockQuantity
Answer these and 20 more on Relational Databases and SQL
Free account. Instant marking, a written explanation for every question.
Start practising freeMore Computing Year 2 topics
- Barcodes, QR Codes and the Functions of Software
- Designing LANs, CANs, MANs and WANs
- Internet Protocols, Addressing and Internet Access
- Logic Gates, Boolean Expressions and Arithmetic
- Machine Learning Concepts and Ethics
- Main Memory, Trees, Graphs and Hash Tables
- Multimedia, Responsive Design, Accessibility and E-commerce
- Python Functions, Conditions, Loops and Recursion
- Web Page Editors, HTML and CSS