Answered step by step
Verified Expert Solution
Question
1 Approved Answer
/ * * * * * * * * * * * * * * * * * * Module 6 : Advanced SQL INFO
Module : Advanced SQL
INFO
Written by Lisa Thoendel
Last Updated Summer
Use the Registration create script to answer these questions.
We will use the below area to write our test SQL
Join student and course together with a natural join and select all rows. Note that this
produces every possible combination of students and courses. There
is not a PKFK relationship between student and course so this is
the only possible join between the tables.
Now let's look at an inner join between students and registration.
This will make use of the PKFK relationship between these tables.
Next, let's add sections to the join giving us a way inner
join. This means we'll see students that are registered for a section
and sections that have students registered.
Suppose we want to see students that aren't registered yet though also.
We'll need an outer join to accomplish that.
By using the NOT IN operator, we can target a list of students that are
not registered only.
Or we can use IN to create a kind of join by subquery. Select the student
names and IDs that are in INFO
Another way to get this same result is by using NOT EXISTS.
Build a master schedule showing every student's names with the class
names, numbers and sections they are registered for. Include the semester.
This brings our whole schema together!
Over time, you may find that you use a query very frequently or that
you have a subset of users that need access to a particular query, but
that shouldn't see the full tables behind that query. These are excellent
use cases for a view! Build a view based on # called schedule.
Query the schedule view for the courses Elliot or James are registered for.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started