S7 Relational Databases and SQL Flashcards

1
Q

What is a database?

A

A way of holding data in an organised way so that it is quick and and easy to find a particular item, or all the items meeting a certain criteria. It contains one or more tables.

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

What sections does a table have?

A

rows, records, fields, columns

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

What is a primary key

A

A unique identifier (no 2 records will have the same)

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

What happens in a relational database?

A

Each entity has its own table, and the tables are linked by a common field

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

What are the advantages of using a relational database?

A

Elimination of data inconsistency and data redundancy.

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

What is a foreign key?

A

A field which is a primary key in a linked table.

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

What are the 3 possible relationships between tables?

A

One-to-one, one-to-many, many-to-many

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

What is SQL used for?

A

Querying and updating tables in a relational database.

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

What is the syntax for a SELECT statement?

A

SELECT list, of, fields, to, be, displayed
FROM list the table/s where the data will come from
WHERE list = “of search criteria”
ORDER BY order of results default = ascending

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

How are dates portrayed in SQL

A

BETWEEN #01/01/2019# AND #31/12/2019#

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

What phrase do you need to use when querying 2 tables?

A

WHERE (Table1. Primary key = Table2. foriegn key)

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

What syntax is used for a INSERT INTO statement?

A

INSERT INTO tableName (column1, column2,…)
VALUES (value1, value 2,…)

NOTE: If all the fields are being added in the correct order, it is not necessary to specify the field names.

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

What syntax is used for an UPDATE statement?

A

UPDATE tableName
SET column1 = value1, column2 = value2,…
WHERE column = value

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

What syntax is used for a DELETE statement?

A

DELETE FROM tableName
WHERE column = value

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