SQL_RelationalAlg Flashcards

(181 cards)

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
26
Explain Projection (Relational Algebra).
27
Which operation is denoted with a pi?
28
29
30
31
32
33
What are Cartesian Products?
34
35
What are Joining relations?
36
What does this symbol represent?
37
38
Explain Natural Join.
39
What does this specific symbol represent?
40
41
Explain Sets or Bags.
42
Differences between sets and bags?
43
Method for selecting from a specific table with conditions.
44
How does query result look?
45
Translate to Relation Algebra Expression.
46
Translate.
47
Translate to Relational Algebra.
48
Translate.
49
50
Translate.
51
Explain Subqueries.
52
53
Why renaming attributes?
54
Why renaming relations?
55
56
Explain Renaming in Relational Algebra.
57
Explain the following expression.
58
Explain Sequencing.
59
60
Explain views.
61
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.
62
Explain the WHERE clause.
63
How to test for membership.
64
What does this mean?
65
66
How do you test for existence?
67
What does this mean?
68
What is a correlated query?
69
70
What are ordinary comparisons?
71
Meaning?
72
How to do comparisons with many rows?
73
What does this mean?
74
75
What are string comparisons?
76
77
What does the NULL symbol means?
78
Can you compare values with NULL?
79
Explain three-valued logic.
80
Results?
81
What does it mean with don't expect usual results with three-valued logic?
82
E-R diagram?
83
Which Approach?
84
Which Approach?
85
Schema?
86
Schema?
87
E-R?
88
E-R?
89
Schema?
90
E-R?
91
Schema?
92
Wrong?
93
Wrong?
94
Wrong?
95
96
Can Constants be used in Projections?
97
Explain Aggregation.
98
What will happen?
99
100
101
102
What will happen?
103
104
What will happen?
105
106
What does single-value query means?
107
NULL in aggregations?
108
Query for capacity at campus?
109
Meaning?
110
Explain Grouping.
111
Explain Grouping in terms of Relational Algebra.
112
Symbol represents?
113
114
115
Explain specialized renaming of attributes.
116
What does this represents?
117
Explain Tests on Groups.
118
Resultat?
119
120
Relational Algebra Translation?
121
Translation?
122
Explain Sorting Relations.
123
What does this represents?
124
What will happen?
125
Describe full structure of SQL query.
126
Translate to relational alebgra.
127
Translate to SQL query.
128
Relational Algebra Expression?
129
SQL expression?
130
Results?
131
Results?
132
Relational Algebra Expression?
133
SQL Expression?
134
135
Explain Lexical vs Logical ordering.
136
What are Available attributes in SELECT?
137
Valid/Invalid.
138
Valid/Invalid?
139
Valid/Invalid?
140
141
142
143
Write Symbols for: Select Project Rename Union
144
Write symbols for: Intersection Difference Cross Product Join
145
Write symbols for: Natural Join Division Grouping
146
Difference between Selection and Projection?
147
Left Outer Join?
148
Right Outer Join?
149
Full Outer Join?
150
Which modifications can be made to the database?
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
Explain Insertions with Queries.
152
What are Explicit Attributes?
153
154
Describe how SQL handles Default Values.
155
Explain Insertion with Default Values.
156
157
Explain Policies for updates and deletions.
158
Explain Cascading.
159
Explain Set NULL.
160
161
Explain Single-attribute constraints.
162
Explain how to specificy that a value must be non NULL
163
Explain a Special Case of References.
164
165
Which are the different types of constraints?
166
167
Explain Triggers.
168
Explain Assertions as Triggers.
169
Explain the basic Trigger structure.
170
Explain Stored Procedures.
171
What does NEW in Triggers refer to?
172
Example of Trigger structure.
173
Explain Trigger events.
174
What does FOR EACH ROW mean?
175
Explain Trigger Conditions.
176
177
Explain views.
178
Elaborate on updating Views.
179
Explain Triggers on Views.
180
Summarize Triggers.
181