SQL part 5 Flashcards

(11 cards)

1
Q

three types of outer join

A

full outer join (not supported in mysql or msaccess)
left outer join
right outer join

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

outer join returns

A

not only rows matching join condition, but also rows with unmatched values

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

outer join basically provides an inner join plus

A

additional rows, with partial info, where join condition wasn’t true

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

you have two tables. table A has emp_id 201, 202, and 203 with fname and lname. table B has emp_id 202, 203, and 204 with salary.
what is the output if you use left outer join?

A

201 emp_id, fname, lname, blank emp_id and salary
202 emp_id, fname, lname, emp_id, salary
203 emp_id, fname, lname, emp_id, salary

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

you have two tables. table A has emp_id 201, 202, and 203 with fname and lname. table B has emp_id 202, 203, and 204 with salary.
what is the output if you use right outer join?

A

202 fname, lname, emp_id, salary
203 fname, lname, emp_id, salary
null, null, null, emp_id (204), salary

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

if statement

A

allows for displaying results that satisfy conflicting conditions at the same time

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

if syntax

A

select if (condition1, result1, result2) from…

condition1 = logical conditional (T/F)
result1 = value if true
result2 = value if false

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

union of two sql statements

A

combines the output of 2 select statements
- supports combining databases
- supports representing multiple competing conditions simultaneously

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

union of 2 sql statements requires

A

same number of attributes in each statement, and corresponding data types to be compatible

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

t/f: union of 2 sql statements does not remove duplicates

A

false. it does.

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

union syntax

A

select…from…where
UNION
select…from…where

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