Week 10 - PHP & MySQL Part 1 Flashcards
What’s the difference between databases and relational databases?
Databases are a collection of information stored in such a way where a computer can quickly access it.
A relational database organises this table into tables with fields (columns) and records (rows).
USE
Used to select a database then perform operations on it with other SQL commands.
CREATE
Used to make new sets of data.
DROP
Used to delete entire tables or the schema altogether.
SELECT
Used to choose certain sets of data or everything.
INSERT
Used to add data into a table.
UPDATE
Used to change and manage data in a table.
DELETE
Used to remove data in a table
What are primary and foreign keys used for?
They are used for linking together relational databases and identifying certain records within tables.
What’s the difference between primary and foreign keys?
Primary and foreign keys are both used for uniquely identifying a record in a table.
However, foreign keys are the primary keys of another table, so this allows us to link the 2 tables together.
(Eg: car makes table and car owner tables)
Schema
An outline of a database.
Why do we need a database?
Databases allow for large volumes of data to be stored in one location making it easier to organise and retrieve when required.
What are queries and how are they different to SQL?
SQL is a language for DBMS’s and queries are how we make requests and talk to the database.
Example of one to one relationship?
Department and head
Example of one to many relationship?
Family and pet