We use two tables in a nested query. In order to understand the query, we think
ID: 3814570 • Letter: W
Question
We use two tables in a nested query. In order to understand the query, we think of an imaginary tuple variable. In which table do we use the tuple variable? (a) only the inner table (b) only the outer table (c) both the inner table and the outer table If we join two tables in which the join condition connects two columns from the two tables with different domains, do we get an error? (a) yes (b) no When we qualify the attribute names with the aliases of tables to prevent ambiguity, we do it by suffixing the aliases to the attribute names. (a) true (b) false Which of the following ways can NOT be used to remove the duplicate rows in tables? (a) use DISTINCT (b) use the GROUP BY clause (c) use the UNIQUE function (d) use the UNION operatorExplanation / Answer
7)
Ans: a) only the inner table
Example:
select max(T.cal_week_nbr) as maxId, min(T.cal_week_nbr) as minId,max(T.cal_week_nbr) as maxWeek, min(T.cal_week_nbr) as minWeek,
min(T.cal_date_start_ts) as StartDate, max(T.cal_date_end_ts) as EndDate from(
select distinct cal_week_nbr,cal_date_start_ts,cal_date_end_ts,cal_year_nbr from calender_dim where cal_year_nbr = 2014 group by cal_week_nbr
) as T;
2)
Ans: no
9)
false.
we do by prefixing the alias to attribute name
example: select T.name from table1 as T
10)
d) Use the UNION operator