I am supposed to display drivers who have not been assigned a shift. I have joined the table through the primary key of the driver number. Here’s my code.
select distinct dr_drvname
from driver,shift
where dr_drvnum <> sh_drvnum;
I have made the driver numbers not equal in my code to show the ones not qualified but this code displays all the drivers.
In counterpoint to Justin’s answer, here’s a version using joins:
In general, it’s preferable to always explicitly specify your joins, not to use the implicit-join syntax (comma-separated
FROMclause).(but why are you prefixing columns with a -short- table prefix:
'dr_'? Including in the initial table? When you appear to have them prefixed with a slightly longer one anyways:'drv'?)