SQL_RelationalAlg Flashcards

(148 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

How to Create and Drop Tables?

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

What are Table declaration elements?

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

Why add NOT NULL when creating tables?

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

How to declare keys?

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

How to add Primary Key SQL?

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

How to code foreign keys?

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

Rules concerning Foregin Keys.

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

Code in SQL.

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

Another Example

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

How to use value constraints?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
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
13
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
14
Q

How to insert data to this table?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
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
16
Q

How to Delete rows from Table.

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

How to update tables.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
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
19
Q

What does SQL means?

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

How is Algebra defined in this context?

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

What is relational algebra?

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

Explain Selection (Relational Algebra).

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

Which operations is denoted with a sigma?

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

Explain Projection (Relational Algebra).

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