Topic 7 - Databases and SQL Flashcards
What is a database?
A structured way to store data so that it can be retrieved using queries
What is the difference between Char and VarChar?
Char is fixed length string
VarChar is variable length string
What is a flat file database?
A database that stores a single table pf data inside a single text file in CSV format
What is a primary key?
A field in a database that holds a unique value
What is the issues with flat file databases?
Inconsistences
Redundancy
What is a relational database?
A database that contains multiple tables which have links know as relationships.
Each table is a relation
What is a foreign key?
A field in a table that refers to the primary key in another table
What can relationships in a table be?
One-to-One
One-to-Many
Many-to-Many
What is SQL?
Structured Query Language
A language that allows us to create, select, update, insert and delete data in a database
What does a wildcard (*) do?
Selects all fields
Write the SQL for select
SELECT
FROM
WHERE
What does LIKE do in a select?
Searches for a pattern
What does BETWEEN do in a select?
Selects an inclusive range
Write the SQL for update
UPDATE
SET
WHERE
Write the SQL for delete
DELETE FROM
WHERE