Back
to Tylogix Home Page
A Simple SQL Join
Skill Test
Part 2: Answers (note the
questions from the test are shown here also)
Let there be two files:
- FILEA with 100 rows with a numeric unique key
spanning from 1 to 100.
- FILEB with 10 rows with a numeric unique key
spanning from 1 to 10.
- TABLEA
|
- TABLEB
|
1
2
3
.
.
.
.
100
|
1
2
3
.
.
.
10
|
Using the keys above:
- TABLEA EXCEPTION JOIN TABLEB should yield
how many rows?
o
Expected
answer: 90 rows
- TABLEB EXCEPTION JOIN TABLEA should yield
how many rows?
o
Expected
answer: 0 rows
- TABLEA INNER JOIN TABLEB should yield
how many rows?
- TABLEB INNER JOIN TABLEA should yield
how many rows?
- TABLEA LEFT OUTER JOIN TABLEB should yield
how many rows?
- Expected answer: 100
rows
- TABLEA LEFT OUTER JOIN TABLEB should yield
how many NULL values?
- TABLEB LEFT OUTER JOIN TABLEA should yield
how many rows?
- 8. If TABLEA had a numeric key and TABLEB had numbers in a
character field, is there a way to still do the join?
Expected answer:
Yes, with a “CAST” operation.
Let there be two files:
- PLANT_TABLE with 10 rows
with a numeric unique key spanning from 1 to 10.
- ITEM_TABLE with 3 rows
with numeric unique keys 123, 456, 789
PLANT_TABLE
|
ITEM_TABLE
|
1
2
3
.
.
.
10
|
123
456
789
|
- PLANT_TABLE CROSS JOIN ITEM_TABLE would yield
how many rows?
Back to Tylogix Home Page