sql Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a flat-file database?

A

A database made up of one table

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

What is a relational database?

A

A database containing more than one table

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

What is an entity?

A

a collection of all related records

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

What is a primary key?

A

a unique value in a table e.g. teacher_ID

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

What is a secondary key?

A

data that can be used for a specific search e.g.teacher_name

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 that references the primary key of another table

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

What are the 3 types of relationships?

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

Why is a many-to-many relationship a potential problem?

A

it will be difficult to reassemble the data

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

How do you select all the data from a table?

A

SELECT*

FROM table_name

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

How do you select specific data from a table?

A

SELECT attribute1, attribute2

FROM table_name

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

How do you select data depending on the value of an attribute?

A

SELECT*
FROM table_name
WHERE attribute=value

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

How do you order data by ascending order?

A

SELECT*
FROM table_name
ORDER BY attribute ASC

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

How do you order data by descending order?

A

SELECT*
FROM table_name
ORDER BY attribute DESC

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

How do you select data from 2 tables?

A

SELECT table1_attribute,
table2_attribute
FROM table1, table2

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

How do you select data and join 2 tables?

A

SELECT*
FROM table1, table2
WHERE
table1attribute+table2attribute

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

What are the advantages of a flat-file database?

A
all records stored in one place
easy to understand
easy to set up
simple sorting of records
simply view or extract records
every day things like business contacts can be stored and used
17
Q

What are the disadvantages of a flat-file database?

A
potential duplication
non-unique records
harder to update
inefficient
harder to change data format
poor at complex queries
poor at limiting access
18
Q

What are the advantages of relation databases?

A
no multiple record changes needed
more efficient
simple to delete or modify details
complex queries can be carried out
better security
cater for future requirements