Unit 2, Databases Flashcards

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

What is meant by the end-user requirements?

A

the tasks that the user wishes to be able to perform

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

What is meant by the functional requirements of a database?

A

the tasks that the database system will be able to perform

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

What is meant by a one to many cardinality?

A

One-to-many relationships can exist when one entity can be present in many other entities (e.g in an airport database one plane can be capable of flying on many different routes)

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

What is meant by a primary key?

A

A field that uniquely identifies a record in a relational database

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

What is meant by a foreign key?

A

A foreign key is a primary key in another table that allows two tables to be linked together and ensures referential integrity

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

What can we do when there is no field that is suited to be a primary key in a table?

A

We can create what is known as a surrogate key, one such surrogate key would be an auto number generator which generates a unique value for each record

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

What is meant by a composite key?

A

A composite key is a specific type of primary key that uses the contents of two or more fields from a table to create a unique value

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

What is meant by a compound key?

A

A compound key is similar to a composite. however, A compound key is a specific type of primary key that uses the contents of two or more fields from different tables

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

What are the aggregate functions that we use in SQL?

A
  • AVG ()
  • SUM ()
  • COUNT ()
  • MAX ()
  • MIN ()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the purpose of an AVG () aggregate function?

A

Returns the average value of a numeric column or expression

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

What is the purpose of the SUM () aggregate function?

A

Returns the total sum of a numeric column or expression

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

What is the purpose of a COUNT () aggregate function?

A

Returns the number of rows of the database that match the WHERE clause of the SQL

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

What does the MAX () aggregate function do?

A

MAX () returns the largest value in the selected column or expression

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

What does the MIN () aggregate function do?

A

MIN () returns the lowest value in a selected column or expression

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

What do aggregate functions require to not produce an error message?

A

Parameters

Like a pre-defined function an error message will appear if no parameters are given for the aggregate function to act on

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

What is the range of numbers that the COUNT () aggregate function can return?

A

Any number that is >= 0 as COUNT should not be able to return any negative numbers

17
Q

What are the rules about mixing aggregate functions with non-aggregate functions and where do we use aggregate functions in SQL?

A

Aggregate functions are used in the SELECT statement, you can use two or more aggregate functions in the select statement however you cannot mix aggregate functions with non-aggregate functions as this will produce an error message

18
Q

What is meant by an Alias?

A

Aliases can be used if we want to temporarily change the name of something

19
Q

In which situations might an alias be used?

A
  • When the field name is too long and we want to shorten it
  • When the field name wouldn’t make sense to a user and for this reason we would need to change it to improve usability
20
Q

What is a GROUP BY statement used for in SQL?

A

GROUP BY is used to group a set of records together by some given criteria

21
Q

What takes precedence in SQL a GROUP BY or an ORDER BY?

A

The GROUP BY statement takes precedence and must precede the ORDER BY statement

22
Q

What is meant by a wild card?

A

A wild card is a character that can be substituted for another character or another set of characters

23
Q

How can we use wildcards in SQL?

A

Wildcards can be used in the WHERE statement and require a separate LIKE statement to be used e.g
WHERE firstName LIKE “L*”

24
Q

What does a * do in a wildcard?

A
  • is used to denote a set of characters
25
Q

What does “?” do in a wildcard?

A

? is used to denote a single character

26
Q

What would this wildcard do WHERE surname LIKE “M*e” ?

A

This wildcard would find any surnames that start with an M and end with an e

27
Q

What do we do when testing a database?

A

We create a table that lists the expected results and the actual results and if the expected results match the actual results then the program is fit for purpose