Question: SQL PLUS exercies As you do the exercises, it is a good idea to copy/paste your query as well as your query result into a

SQL PLUS exercies As you do the exercises, it is a good idea to copy/paste your query as well as your query result into a word processor. 3-1. Stu sname Jones Smith Evans Adams Create two tables, Stu(sname, majorcode) and Major(majorcode, majordesc) with the data shown. Use VARCHAR2(2) for codes and appropriate data-types for the other attributes.

a.) Display the Cartesian product (no WHERE clause). Use SELECT *.... How many rows did you get? How many rows will you always get when combining two tables with n and m rows in them (Cartesian product)?

b.) Display an equi-join of Stu and Major on majorCode (show this both ways: first using an appropriate WHERE clause; and second, using ANSI SQL standard syntax). Use table aliases. How many rows did you get?

c.) Leave off the column qualifiers (the aliases) on the equi-join in step b. What do you get? This will give an error because of ambiguous column names.

d.) Use the COUNT(*) function instead of SELECT * in the query. Use COUNT to show the number of rows in the result set of the equi-join and the Cartesian product. Do the equi-join first with COUNT, then comment out the WHERE clause for the second answer (put -- in front of the word WHERE).

e.) Add two more major codes to the Major table as follows: and . Display all the student names (snames) and majorDescs, but I would also like to see all the majors listed, even if there are no students taking that major. Show your query in both ways: first, using ANSI SQL standard syntax, and then using Oracles driving table(+) concept

f.) Add two more students to the Stu table as follows: and . 87 Display all the student names (snames) and majorDescs, whether the students have a major or not. Show you query both ways: first, using ANSI SQL standard syntax, and then using the Oracles driving table (+) concept.

g.) Display all the student names (snames) and majorDescs. Make sure all the students as well as all the majors are shown in the result set, whether the students have a major or not, and whether the major has students or not.

Here is the table

SQL PLUS exercies As you do the exercises, it is a good

Stu snamemajorCode Jones Smith Evans Adams CS AC MA CS Major majorCode majorDesc AC CS MA Accounting Computer Science Math

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!