Database-chap 9 Flashcards

SQL (13 cards)

1
Q

The relational join operation merges rows from 2 tables and returns the rows with one of
the following conditions

A

– Have common values in common columns (natural
joint)
– Meet a given join condition (equality or inequality)
– Have common values in common columns or have no
matching values

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

Relational Set Operators

A

-Work properly if relations are union-compatible
– Names of relation attributes must be the same and
their data types must be identical

  • Inner join
    – Only rows that meet a given criterion are selected
  • Outer join
    – Returns not only matching rows but the rows with
    unmatched attribute values for one table or both
    tables to be joined
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

UNION

A

will exclude duplicate records

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

UNION ALL

A

will retain the duplicate rows

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

INTERSECT

A

Combine rows from two queries, returning only the rows that appear in both sets

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

MINUS

A

Combines rows from two queries and returns only the rows that appear in the first set but not
in the second

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

JOIN ON Clause

A
  • If no common attribute exist in both tables
  • Query will return only the rows that meet the indicated join condition
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Outer Joins

A
  • Returns not only matching rows, but also rows with unmatched attribute values for one table or
    both tables to be joined
  • Three types
    – Left
    – Right
    – Full
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

LEFT Outer Joins

A

Returns rows matching the join condition AND rows in the left table with unmatched values in
the table

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

RIGHT Outer Join

A
  • Returns rows matching the join condition AND rows in the RIGHT table with unmatched values
    in the table
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

FULL Outer Joins

A
  • Returns rows matching the join condition, but also returns all of the rows with unmatched values in the table on either side
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Triggers

A

A trigger is procedural SQL code that is automatically invoked by the RDBMS upon the occurrence of a
given data manipulation event. It is useful to remember that:
– A trigger is invoked before or after a data row is inserted,
updated or deleted.

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

Types of Triggers

A

-A statement-level trigger is assumed if you omit the FOR EACH ROW keywords.
-A row-level trigger requires use of the FOR EACH ROW keywords.

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