Week 10 - PHP & MySQL Part 1 Flashcards

1
Q

What’s the difference between databases and relational databases?

A

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).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

USE

A

Used to select a database then perform operations on it with other SQL commands.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

CREATE

A

Used to make new sets of data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

DROP

A

Used to delete entire tables or the schema altogether.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

SELECT

A

Used to choose certain sets of data or everything.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

INSERT

A

Used to add data into a table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

UPDATE

A

Used to change and manage data in a table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

DELETE

A

Used to remove data in a table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are primary and foreign keys used for?

A

They are used for linking together relational databases and identifying certain records within tables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What’s the difference between primary and foreign keys?

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Schema

A

An outline of a database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Why do we need a database?

A

Databases allow for large volumes of data to be stored in one location making it easier to organise and retrieve when required.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are queries and how are they different to SQL?

A

SQL is a language for DBMS’s and queries are how we make requests and talk to the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Example of one to one relationship?

A

Department and head

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Example of one to many relationship?

A

Family and pet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Example of many to many relationship?

A

Students and units

17
Q

Should we have many to many relationships?

A

No, it’s better that we separate them. We can do this with junctions or associative tables to make it one to many.