Databases Flashcards
What is the difference between data and information?
Information is data with context
What value does data have?
Monetary and personal
What must data have in order to be useful?
Integrity, accuracy, reliability
What does accuracy mean?
The truth of data
What does reliability mean?
How much variation in the data for the same thing
What does integrity mean?
How much the database can be trusted to be complete, accurate and reliable over its lifetime
What are the two ways of storing data?
Structured or Unstructured. Eg school timetable vs your photos
What is a database?
A structured collection of data that allows users to extract information easily
What are the advantages of structured data?
It is easier to find information, add data, update, delete, and maintain integrity
How is a database constructed?
Key field = Primary Key
What is the primary key?
The field that uniquely identifies each record in the table. No two primary key records can be the same
What are the two types of database?
Flat file - data is stored in a single table, each data item is put in manually, which is vulnerable to human error
Relational database - data is stored in multiple tables linked by a common field, usually the primary key. Each field has its own table
What is a foreign key?
The primary key of one table can be placed in another table
What are common data types used by databases?
Integer, decimal, date, currency, char, text, Boolean
How can a link be created between two databases?
The primary key of one table is inserted into a second table as a foreign key, creating a link between the two tables. In SQL, we can write: WHERE student.id = house.id
How do you retrieve data from a table using SQL?
SELECT column1, column2 FROM table_name WHERE condition
How do you order results?
SELECT column1, column2 FROM table_name ORDER BY column2 ASC/DESC
How do you insert data into a table?
INSERT INTO cakes [(flavour, size)] VALUES (chocolate, 5)
How do you edit existing data in a table?
UPDATE students SET age = 21 WHERE id = 1
How do you delete data from a table?
DELETE FROM students WHERE age > 18