Select the best answer
for each question. After completing the quiz, check your answers using
the answer key in the appendix.
-
When is a Cartesian
product returned?
-
When join conditions
are not specified in a PROC SQL join.
-
When join conditions
are not specified in a PROC SQL set operation.
-
When more than two tables
are specified in a PROC SQL join.
-
When the keyword ALL
is used with the OUTER UNION operator.
-
Given the PROC SQL query
and tables shown below, which output is generated?
proc sql;
select *
from certadv.store1, certadv.store2
where store1.wk=store2.wk;
quit;
-
Which output will the
following PROC SQL query generate?
proc sql;
select *
from table1 left join table2
on table1.g3=table2.g3;
quit;
-
What is needed in order
for PROC SQL to perform an inner join?
-
The tables being joined
must contain the same number of columns.
-
The tables must be sorted
before they are joined.
-
The columns that are
specified in a join condition in the WHERE clause must have the same
data type.
-
The columns that are
specified in a join condition in the WHERE clause must have the same
name.
-
Which PROC SQL query
will generate the same output as the DATA step match-merge and PROC
PRINT step shown below?
data merged;
merge certadv.table1 certadv.table2;
by g3;
run;
proc print data=merged noobs;
title 'Merged';
run;
-
proc sql;
title 'Merged';
select a.g3, z, r
from table1 as a full join table2 as b
on a.g3 = b.g3
order by 1;
quit;
-
proc sql;
title 'Merged';
select a.g3, z, r
from table1 as a table2 as b
on a.g3 = b.g3
order by 1;
quit;
-
proc sql;
title 'Merged';
select coalesce(a.g3, b.g3)
label='G3', z, r
from table1 as a full join table2 as b
on a.g3 = b.g3
order by 1;
quit;
-
proc sql;
title 'Merged';
select g3, z, r
from table1 as a full join table2 as b
on a.g3 = b.g3
order by 1;
quit;
-
Which statement about
the use of table aliases is false?
-
Table aliases must be
used when referencing identical table names from different libraries.
-
Table aliases can be
referenced by using the keyword AS.
-
Table aliases or full
table names must be used when referencing a column name that is the
same in two or more tables.
-
Table aliases must be
used when using summary functions.
-
Which statement is true
regarding the use of the PROC SQL step to query data that is stored
in two or more tables?
-
When you join multiple
tables, the tables must contain a common column.
-
You must specify the
table from which you want each column to be read.
-
The tables that are
being joined must come from the same type of data source.
-
If two tables that are
being joined contain a same-named column, you must specify the table
from which you want the column to be read.