SQL_RelationalAlg Flashcards

1
Q

Is SQL case sensitive?

A

Case convention
• SQL is completely case insensitive.
Upper-case or Lower-case makes no
difference. We will use case in the
following way:
– UPPERCASE marks keywords of the SQL
language.
– lowercase marks the name of an attribute.
– Capitalized marks the name of a table.

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

How to Create and Drop Tables?

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

What are Table declaration elements?

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

Why add NOT NULL when creating tables?

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

How to declare keys?

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

How to add Primary Key SQL?

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

How to code foreign keys?

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

Rules concerning Foregin Keys.

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

Code in SQL.

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

Another Example

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

How to use value constraints?

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

Add value constraint that the period is an INT for period 1:4.

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

Another Check Constraint for the Period being an INT of values 1-4.

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

How to insert data to this table?

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

Why is one of those illegal?

CREATE TABLE GivenCourses (
course CHAR(6) REFERENCES Courses,
period INT CHECK (period IN (1,2,3,4)),
numStudents INT,
teacher INT REFERENCES People(ssn) NOT
NULL,
PRIMARY KEY (course, period)
);

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

How to Delete rows from Table.

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

How to update tables.

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

What is a Query? What is the difference between query and modifications?

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

What does SQL means?

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

How is Algebra defined in this context?

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

What is relational algebra?

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

Explain Selection (Relational Algebra).

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

Which operations is denoted with a sigma?

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

Explain Projection (Relational Algebra).

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

Which operation is denoted with a pi?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

What are Cartesian Products?

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

What are Joining relations?

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

What does this symbol represent?

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

Explain Natural Join.

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

What does this specific symbol represent?

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

Explain Sets or Bags.

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

Differences between sets and bags?

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

Method for selecting from a specific table with conditions.

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

How does query result look?

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

Translate to Relation Algebra Expression.

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

Translate.

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

Translate to Relational Algebra.

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

Translate.

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

Translate.

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

Explain Subqueries.

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

Why renaming attributes?

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

Why renaming relations?

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

Explain Renaming in Relational Algebra.

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

Explain the following expression.

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

Explain Sequencing.

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

Explain views.

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

Create a view DBLectures containing room, weekday and hour from the table Lectures. The course should be TDA357 and the period should be 3. Then query the weekday from the view based on the room HC1.

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

Explain the WHERE clause.

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

How to test for membership.

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

What does this mean?

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

How do you test for existence?

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

What does this mean?

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

What is a correlated query?

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

What are ordinary comparisons?

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

Meaning?

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

How to do comparisons with many rows?

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

What does this mean?

A
74
Q
A
75
Q

What are string comparisons?

A
76
Q
A
77
Q

What does the NULL symbol means?

A
78
Q

Can you compare values with NULL?

A
79
Q

Explain three-valued logic.

A
80
Q

Results?

A
81
Q

What does it mean with don’t expect usual results with three-valued logic?

A
82
Q

E-R diagram?

A
83
Q

Which Approach?

A
84
Q

Which Approach?

A
85
Q

Schema?

A
86
Q

Schema?

A
87
Q

E-R?

A
88
Q

E-R?

A
89
Q

Schema?

A
90
Q

E-R?

A
91
Q

Schema?

A
92
Q

Wrong?

A
93
Q

Wrong?

A
94
Q

Wrong?

A
95
Q
A
96
Q

Can Constants be used in Projections?

A
97
Q

Explain Aggregation.

A
98
Q

What will happen?

A
99
Q
A
100
Q
A
101
Q
A
102
Q

What will happen?

A
103
Q
A
104
Q

What will happen?

A
105
Q
A
106
Q

What does single-value query means?

A
107
Q

NULL in aggregations?

A
108
Q

Query for capacity at campus?

A
109
Q

Meaning?

A
110
Q

Explain Grouping.

A
111
Q

Explain Grouping in terms of Relational Algebra.

A
112
Q

Symbol represents?

A
113
Q
A
114
Q
A
115
Q

Explain specialized renaming of attributes.

A
116
Q

What does this represents?

A
117
Q

Explain Tests on Groups.

A
118
Q

Resultat?

A
119
Q
A
120
Q

Relational Algebra Translation?

A
121
Q

Translation?

A
122
Q

Explain Sorting Relations.

A
123
Q

What does this represents?

A
124
Q

What will happen?

A
125
Q

Describe full structure of SQL query.

A
126
Q

Translate to relational alebgra.

A
127
Q

Translate to SQL query.

A
128
Q

Relational Algebra Expression?

A
129
Q

SQL expression?

A
130
Q

Results?

A
131
Q

Results?

A
132
Q

Relational Algebra Expression?

A
133
Q

SQL Expression?

A
134
Q
A
135
Q

Explain Lexical vs Logical ordering.

A
136
Q

What are Available attributes in SELECT?

A
137
Q

Valid/Invalid.

A
138
Q

Valid/Invalid?

A
139
Q

Valid/Invalid?

A
140
Q
A
141
Q
A
142
Q
A
143
Q

Write Symbols for:

Select

Project

Rename

Union

A
144
Q

Write symbols for:

Intersection

Difference

Cross Product

Join

A
145
Q

Write symbols for:

Natural Join

Division

Grouping

A
146
Q

Difference between Selection and Projection?

A
147
Q

Left Outer Join?

A
148
Q

Right Outer Join?

A
149
Q

Full Outer Join?

A
150
Q

Which modifications can be made to the database?

A

Modifying the contents of a database:
– Insertions
INSERT INTO tablename VALUES tuple
– Deletions
DELETE FROM tablename WHERE test over rows
– Updates
UPDATE tablename
SET attribute = value
WHERE test over rows

151
Q

Explain Insertions with Queries.

A
152
Q

What are Explicit Attributes?

A
153
Q
A
154
Q

Describe how SQL handles Default Values.

A
155
Q

Explain Insertion with Default Values.

A
156
Q
A
157
Q

Explain Policies for updates and deletions.

A
158
Q

Explain Cascading.

A
159
Q

Explain Set NULL.

A
160
Q
A
161
Q

Explain Single-attribute constraints.

A
162
Q

Explain how to specificy that a value must be non NULL

A
163
Q

Explain a Special Case of References.

A
164
Q
A
165
Q

Which are the different types of constraints?

A
166
Q
A
167
Q

Explain Triggers.

A
168
Q

Explain Assertions as Triggers.

A
169
Q

Explain the basic Trigger structure.

A
170
Q

Explain Stored Procedures.

A
171
Q

What does NEW in Triggers refer to?

A
172
Q

Example of Trigger structure.

A
173
Q

Explain Trigger events.

A
174
Q

What does FOR EACH ROW mean?

A
175
Q

Explain Trigger Conditions.

A
176
Q
A
177
Q

Explain views.

A
178
Q

Elaborate on updating Views.

A
179
Q

Explain Triggers on Views.

A
180
Q

Summarize Triggers.

A
181
Q
A