Answer
Flashcards · 9210 · Topic 7
Relational databases and structured query language (SQL) flashcards
8 cards on Topic 7. 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.
Choose your cards
Session complete
Worth another look:
All 8 cards
For a quick read-through or printing. Cover the right-hand side to test yourself.
Topic 7: Relational databases and structured query language (SQL)
- What are a table, a record and a field in a database?
- Table: data about one type of thing. Record: one row, all the data about one item. Field: one column, one item of data about each record.
- What is a primary key?
- A field that uniquely identifies each record in a table, such as StudentID.
- What is a foreign key?
- A field in one table that is the primary key in another table, used to link the two tables.
- Why is a relational database better than one flat file?
- Data is stored once in linked tables, so there is less data redundancy, fewer inconsistencies, and less storage is needed.
- What does this SQL do? SELECT Name FROM Pupil WHERE Age > 14
- Lists the Name of every pupil older than 14. Retrieval in 9210 uses only SELECT, FROM and WHERE (ORDER BY is not in the specification).
- How do you add a new record in SQL?
- INSERT INTO Pupil VALUES (25, 'Ali', 15) The 9210 specification requires only the form that gives a value for every field, in field order.
- How do you change and remove records in SQL?
- UPDATE Pupil SET Age = 16 WHERE PupilID = 25 DELETE FROM Pupil WHERE PupilID = 25 Without WHERE, every record would be changed or deleted.
- How do you get data from two linked tables in SQL?
- List both tables and match the foreign key to the primary key, e.g. SELECT Pupil.Name, Form.Tutor FROM Pupil, Form WHERE Pupil.FormID = Form.FormID