Using the view you made in (“ALTSKIP”), https://www.chegg.com/homework-help/ques
ID: 3668474 • Letter: U
Question
Using the view you made in (“ALTSKIP”),
https://www.chegg.com/homework-help/questions-and-answers/create-table-subjects-code-varchar-15-null-primary-key-insert-subjects-values-cs-ece-edco--q10607173,
write a SQL query that will display subject codes across in two columns like the following:
FirstC SecondC
ARCH ART
BC CS
ECE EDCO
FIN FST
MKTG PHYS
SOC SPAN
STAT
You may need a left outer join. Again, your query should be general and be
able to run on any instance of the Subjects table, not just the one shown above.
The empty cell can be NULL as well.
Explanation / Answer
-- View create query
create view ALTSKIP as
select code from
(select code, rownum rn from Subjects order by code)
where mod(rn, 2) <> 0;
-- -----new query to fetch data as per new question
select a1.code, a2.code
from
(select vw.code, rownum rn1 from ALTSKIP vw order by vw.code) as a1
LEFT OUTER JOIN
(select code, rownum rn2 from
(select code from
(select code, rownum rn0 from Subjects order by code)
where mod(rn0, 2) = 0)) as a2
where a1.rn1 = a2.rn2;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.