SQL Examples Flashcards

1
Q

How to implement cartesian product in SQL?

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

What are some of the string operations in SQL?

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

How is “in” operator used in SQL?

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

What is a Sub Query?

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

What are Nested Subqueries?

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

How are subqueries in the Where clause formed?

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

How is set comparison operator “Some” clause used in SQL?

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

How is set comparison operator “all” clause used in SQL?

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

How and why is a “exists” clause and “not exists” used?

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

How to test for absence of duplicate tuples using “Unique” clause?

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

How are subqueries in the From clause formed?

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

How is SQL “With” clause used?

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

How are subqueries in the Select clause formed?

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

How to delete tuples from a table in SQL?

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

How to insert tuples into a table in SQL?

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

How to update a tuple in SQL?

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

How is the conditional statement “CASE” used in SQL?

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

What are the different types of joins between relations?

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

What is “inner join”?

A
20
Q

What is “outer join”?

A
21
Q

What is “Left Outer Join”?

A
22
Q

What is “Right Outer Join”?

A
23
Q

What is “Full Outer Join”?

A
24
Q

What is “Self Join”?

A
25
Q

What is a view?

A
26
Q

How to define a view in SQL?

A
27
Q

What are composition of views in SQL? aka View Expansion

A
28
Q

How to update a view?

A
29
Q

What are materialized views?

A
30
Q

What are Transactions?

A
31
Q

What are integrity Constraints? Give examples

A
32
Q

What is referential integrity?

A
33
Q

What are cascading actions in referential integrity?

A
34
Q

What are SQL Data types?

A
35
Q

How to create an Index in SQL?

A
36
Q

How to create a User Defined data type in SQL?

A
37
Q

What are domains? and how to create domains in SQL?

A
38
Q

What are the Authorization Specifications in SQL? What are the previleges in SQL?

A
39
Q

How to revoke authorizations in SQL?

A
40
Q

What are Roles in SQL? how are they created?

A
41
Q

What are triggers?

A

A trigger defines a set of actions that are performed in response to an insert, update,
or delete operation on a specified table

To design a trigger mechanism, we must:
◦ Specify the events / (like update, insert, or delete) for the trigger to executed
◦ Specify the time (BEFORE or AFTER) of execution
◦ Specify the actions to be taken when the trigger executes

There are two types of triggers based on the level at which the triggers are applied:

1.Row level triggers
2.Statement level triggers

Used for logging, Auditing users and their actions, adding additional values to a table, simple validataion.

Adding triggers is often seen as faster and easier than adding code to an application,
but the cost of doing so is compounded over time with each added line of code

42
Q

Property of aggregate functions with respect to null values

A

Except count(*) all other aggregate functions ignore NULL Values

43
Q

What is the difference between where clause and having clause

A

In where clause you cannot use aggregate functions.. normally group by clause is executed before having clause and so aggregate functions could be used on having clause

44
Q

What does Check integrity constraint mean ?

A

It is set while creating the table and is enforced whenever data is added

Age INT CHECK(Age>18)

45
Q

What character is used to signify space while using like clause

A

%