Introduction to logical design & creating conceptual tables Flashcards

1
Q

What do we do In the second database design phase (i.e., logical design)?

A

In the second database design phase (i.e., logical design) we translate
the ER model to a set of conceptual relational tables called schemas

(In the logical database design phase, our focus turns to conceptually
designing these tables in the most optimal way, before creating them in
our database during phase 3 (physical design))

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

What is a similarity between OOP and Database design?

A

§ Each table has a distinct name. E.g., we cannot have two tables called “Student”,
much like we cannot have two classes named “Student” in OOP (at least not in the
same namespace)

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

What does each cell in a table contain?

A

Each cell in a table contains exactly one value, be it single- or multi-valued

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

Can we mix numerical and textual values in a column?

A

§ The values of a column/attribute are all from the same domain
§ For example, we cannot mix numerical and textual values in a column

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

Does the order of columns/attributes or rows/values havy any significance?

A

The order of columns/attributes or rows/values has no significance

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

Is it important that each row in a table is distinct?

A

it is important that each row is distinct. I.e., we cannot allow a unique
identifier to be common

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

What is a set, in Set theory?

A

A set is any collection of objects, which are referred to as
elements/members of a set
§ For example, the set of all the registered students taking this course

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

What is Set theory?

A

Set theory is a branch of mathematical logic that studies sets

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

What will learning to apply set theory help with?

A

Learning to apply set theory will help with your understanding of relational
database tables, as well as relational algebra and SQL

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

What is one way of describing a set with a small number of elements?

A

§ One way of describing a set with a small number of elements is by listing
them. E.g., the set of all positive integers that are less than 4 can be
written as: {1, 2, 3}

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

Does it matter in which order the elements of a set occurs?

A

The order in which the elements of a set occurs does not matter
§ Much like how the columns in a spreadsheet table does not matter

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

What do you do with repeated elements in a set?

A

Repeated elements are ignored

§ E.g., the set {1,1,2} is the same as {1,2}

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

What can we do to visualize sets and elements?

A

To visualize sets, we can use uppercase letters (e.g., A,B,C) and to
visualize elements of sets, we can use lowercase letters (e.g., a,b,c)

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

we can indicate that the element x is a member

of the set A by writing:

A

x € A

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

we can indicate that x is not a member of the set A by writing:

A

x /€ A (sträcket är över E märket)

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

What would be inconvenient for larger sets?

A

For larger sets, it would be inconvenient to describe the set by listing its elements

17
Q

What would be an alternative to describing larger sets?

A

an alternative would be to specify a property that all the elements
have in common
§ For this purpose, we can use P(x) to describe a proposition, P, concerning the
variable x. A set defined by this proposition would look like:

{x|P(x)}

  • Where “|” means “such that”

Example:

{x|x is a positive integer less than 4}

18
Q

In Set operations, what is Union? How does it look like when we Unionize something?

A

Say A and B are two sets, we can unionize these by writing A ⋃ B:

A ⋃ B = {x|x ∈ A or x ∈ B}

§ This means that we will take all the elements from A and combine them with all the elements from B while eliminating duplicates:

A = {1,2,2,4}
B = {1,13,30}
A ⋃ B = {1,2,4,13,30}

19
Q

In Set operations, what is Intersection? How does it look like when we Intersection something?

A

If A and B are sets, we define their intersection as the set consisting of
all elements that belong to A and B and write it as A ⋂ B:

A ⋂ B = {x|x ∈ A and x ∈ B}

This means that we will take all the elements that belong to A and B,
while removing duplicates:

A = {1,2,2,4}
B = {1,13,30}
A ⋂ B = {1}

(Both A and B has the number 1, therefore the intersection shows the number 1)

20
Q

In Set operations, what is relative complement? How does it look like when we relative complement something?

A

§ We can use relative complement to get the difference between two sets,
based on the first set:

A\B = {x|x ∈ A and x ∉ B}

§ I.e., we can retrieve all elements from set A which do not occur in set B:

A = {a,b,c}
B = {d,e,f,a}
A\B = {b,c}
21
Q

What is disjoint sets?

A

Sets with no common elements, such as {a,b,c} and {d,e,f}, are known
as disjoint sets

22
Q

In Set operations, what is cartesian product? How does it look like when we cartesian product something?

A

The cartesian product operation allows us to retrieve a set of all the
ordered pairs from two sets, A and B
* An ordered pair (x,y) is a collection of
2 elements

If A and B are two nonempty sets, we define the Cartesian Product as:

A x B = {(x,y)|x ∈ A and y ∈ B}

Example:

If we have:

Children = {Carl, Mary, Sophie}
Parents = {Charles, Sara}

Then:

Children x Parents = {
(Carl,Charles),(Carl,Sara),
(Mary,Charles),(Mary,Sara),
(Sophie,Charles),(Sophie,Sara)
}
23
Q

In Set Relations, what does Relations (R) describe?

A

Relations describe associations between objects. a relation, R, between the two
nonempty sets A and B is a set of pairs:

R = {(a1,b1),(a2,b2),…}

§ where every a(index) is a member of A and every b(index) is a member of B. In other words, R, acts as a subset of
A x B.

24
Q

In Set Relations, Consider A={Sweden,Finland} and B={Uppsala,Göteborg,Helsinki},
then what is A x B?

A

{(Sweden,Uppsala),(Sweden,Göteborg),(Sweden,Helsinki),
(Finland,Uppsala),(Finland,Göteborg),(Finland,Helsinki
)}

25
Q

In Set Relations, Consider A={Sweden,Finland} and B={Uppsala,Göteborg,Helsinki},

What is the generated R in this relationship?:

a R b iff b is a city in a

A

The generated R would be:

R = {(Sweden,Uppsala),(Sweden,Göteborg),(Finland,Helsinki)}

26
Q

What is a function?

A

A function is something we’re all familiar with from mathematics. E.g.,
the function f(x)=x2. For every input, x, we get an output, x2. Such as:
f(2)=4, f(3)=9 etc

27
Q

In Set Functions, what is the idea behind a function?

A

The idea behind a function is that we do something to every input
(from A) which generates one output (from B)

28
Q

what does a Set Function from A to B

(denoted f : A → B) signify?

A

A function from A to B (denoted f : A → B) signifies a relation from A to B
such that for all elements x ∈ Dom(f), f(x) contains just one element of B

• Where Dom represents the domain, i.e., the input must come from our domain
or set A

• The generated output must instead be something within our
range/codomain, i.e., an element from our set B

29
Q

In Set Functions, what are Functions also called? and why?

A

Functions are also called mappings or transformations, since they can
be viewed as rules. One such rule being that for every element x ∈ A,
there is an element y ∈ B such that (x,y) ∈ F
§ In other words, for every input x, there is some output y

30
Q

Let A = {a,b,c,d} and B = {1,2,3,4,5}. Create the function f : A → B

A
Let	A = {a,b,c,d} and	B = {1,2,3,4,5} and	we	create	the	following	
function	f : A → B as	follows:

f = {(a,3),(b,2),(c,4),(d,1)}

§ Note that the element 5 appears in the B-set but is not mapped to
another value. This is still in accordance with the rules of our function.
I.e., we don’t necessarily have to map our inputs to all outputs for it to
be a valid function

31
Q

How do you conceptually design tables in the most optimal way, before creating them in
our database during phase 3 (physical design)

A

To this purpose, we utilize database schemas such as:

Student (StudID, Name, CourseCode)
Course (CourseCode, Name)

32
Q

What constitutes a schema in the logical design phase?

A

the basic structure of a

table (i.e., its name and its attributes) constitutes the schema

33
Q

What will we use schemas for?

A

schemas are what we will use to act as a blueprint for our future
relational tables

34
Q

What information can we use to build our schemas in the logical design phase?

A

§ From the ER models created during phase 1 (Conceptual Design), we
know of the attributes and relationships that make out our data models

§ We can use this information to build our schemas

35
Q

What should you do when you are in the second phase, logical design and you are gonna create your schemas?

A

For each entity in the ER model, create a schema that includes all the
entity’s simple attributes as well as their unique identifier

36
Q

If we have:

Student (studentID,firstName,lastName,email)
Course (courseID,courseName,credits,pace)

How could the schema Student_Course look like representing the two entities relationship?

A

Student_Course (studentID,courseID,grade)