Deck 1 - Higher Computing - Database Design And Development Flashcards

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

Why do we need end user / functional requirements?

A
  • To clarify the design of the database.
  • To identify the features to be implemented on the database
  • To evaluate whether the system is fit for purpose after development is complete
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are end user requirements?

A
  • What the users want the database to do
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are functional requirements?

A
  • What the database must be able to do
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an entity?

A
  • A table that will be used to store data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an entity occurrence?

A
  • A specific example of an entity
  • For example, John Smith, Mary McLeod and Omar Shaheed are all entity occurrences found in the Student entity; English, Computing and Chemistry are all entity occurrences within the Subject entity
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an attribute?

A
  • Attributes are the fields in each entity occurrence
  • For example, an employee would have attributes such as:
    • ID number
    • Name
    • Role
    • Salary
      etc.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Name the terminology used in an Entity-Relationship Diagram.

A
  • Entity
  • Attribute
  • Primary key
  • Foreign key
  • Compound key
  • Relationship
  • Cardinality
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a primary key?

A
  • A primary key is a field that uniquely identifies a record in a table
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a foreign key?

A
  • A foreign key can be described as a primary key from one table being found in another
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a compound key?

A
  • A compound key is a key made up of two or more primary keys. (e.g. studentID + teacherID)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a relationship?

A
  • A relationship is a natural association between one or more entities
  • For example, Students learn Subjects and Teachers educate Students
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is cardinality?

A
  • Cardinality refers to the participants in a relationship
  • These include:
    • one to one
    • one to many
    • many to many
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Describe a one-to-one relationship?

A
  • In a one-to-one relationship, each entity occurrence in an entity is associated with one, and only one, entity occurrence within a
    related entity
  • For example, a School is managed by one, and only one,
    Headteacher, with a Headteacher managing one, and only one,
    School
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Describe a one-to-many relationship.

A
  • In a one-to-many relationship, each entity occurrence
    in an entity can be associated with one or more entity
    occurrences in a related entity
  • For example, a School employs many Teachers and
    each of those Teachers is employed by one School
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Describe a many-to-many relationship.

A
  • In a many-to-many relationship, several entity occurrences in an entity can be associated with multiple entity occurrences in a
    related entity
  • For example, many Students study several different Subjects and each of those Subjects is studied by many Students
  • Direct many-to-many relationships between two entities cannot
    be implemented by a relational database system. To overcome this many to many relationships are resolved to one to many
    relationships
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Describe entity relationship diagrams.

A
  • An entity-relationship diagram is a graphical
    representation of the entities in a system
  • It is used to summarise the relationship that
    exists between two or more entities
  • An entity-relationship diagram indicates:
    • The name of each entity in the system
    • The name of the relationship between two
      entities
    • The cardinality of the relationship between
      two entities
    • If required, the name of each attribute can
      be shown
17
Q

Describe entity relationship diagram notation.

A
  • The entities on an entity-relationship diagram are
    represented by labelled rectangles
  • If required, the attributes within each entity can be
    represented as labelled ovals
  • The relationship between two entities is represented
    by the labelled line which is used to join the entities
  • Although several different representations can be
    used, the entity-relationship diagrams in the examples
    below make use of the crow’s feet notation to
    indicate the ‘many’ side of a relationship
18
Q

Give an example of an entity relationship diagram.

A

{Mark Appropriately}

19
Q

Describe an entity occurrence diagram.

A
  • An entity-occurrence diagram illustrates the relationships between the entity occurrences of one entity, with the entity occurrences within a related entity
  • The creation of an entity-occurrence diagram helps to identify the cardinality of the relationship that exists between the two entities
  • In an entity-occurrence diagram, each entity is shown as a tall oval
  • Inside each entity, each entity occurrence is represented by the value of its identifier and each relationship is illustrated by drawing a line between associated entity occurrences
20
Q

Give an example of an entity relationship diagram.

A

{Mark Appropriately}

21
Q

What should the design of the SQL query indicate.

A
  • Any field(s) or computated values required
  • The table(s) needed to provide all of the details required
  • Any search criteria to be applied
  • What grouping is needed (if appropriate)
  • The field(s) used to sort the data and the type(s) of sort
    required
  • If the field name has spaces or a non textual character
    such as # then square brackets must be used
22
Q

a) What is a wildcard?

b) What are the functions of ‘*’ and ‘?’ in SQL.

A

a)
- A wildcard character is a character used to replace one or more characters in a string when incomplete information is available and it would be impossible to write a WHERE clause using one of the existing logical operators =, , ≤ or ≥

b)

  • ‘*’ is used to represent zero, one or multiple characters missing
  • ’?’ is used to represent a single character missing
23
Q

Describe aggregate functions.

A
  • Aggregate functions operate on a set of rows to return a single, statistical value
  • You apply an aggregate to a set of rows, which may be:
    • All the rows in a table
    • Only those rows specified by a WHERE clause
    • Those rows created by a GROUP BY clause (see later)
  • In the same way that pre-defined programming functions receive parameter values, SQL aggregate functions require an expression
  • This expression is usually a column name but it can be a column name together with an operator
  • The following points should be noted:
    • SUM( ) and AVG( ) can only be applied to numeric data types; MIN( ) and MAX( ) work with characters, numeric, and date/time datatypes; COUNT( ) works with all data types
    • All aggregate functions except, COUNT( ), ignore nulls
    • COUNT( ) always returns a positive integer or zero. The other aggregate functions return null if the set contains no rows or contains rows with only nulls.
    • An aggregate expression cannot be used in a WHERE clause unless it is a sub query
24
Q

A charity called Animal Help has a website that allows people to raise funds through sponsorship. Details entered are stored in a relational database. Fundraisers can see their total donations from all of their sponsors and Animal Help can view the funds being raised on their behalf.
State two functional requirements of the relational database.

A
  • (A query to) display the total
  • (A query to) display the total donations made to each fundraiser
  • (A query to) allow the charity to display total donations made
  • (A query to) display the total donations from a sponsor(s)
  • (A query to) display the total donations from a fundraiser(s)
  • (A query to) insert new fundraisers/sponsors or make a new donation