Hi all,
I am trying to do an SQL query involving these 2 tables:
CREATE TABLE Student (
StudentNo VARCHAR2(9) NOT NULL,
StudentType VARCHAR2(13),
FirstName VARCHAR2(20),
SecondName VARCHAR2(20),
Sex VARCHAR2(6),
DateOfBirth DATE,
HomeSteet VARCHAR2(20),
HomeTown VARCHAR2(15),
HomeCity VARCHAR2(15),
HomePostCode VARCHAR2(8),
HomeTeleNo CHAR(15),
ProgramOfStudy VARCHAR2(30),
DepartmentName VARCHAR2(30),
Year VARCHAR2(3),
YearTutor VARCHAR2(20),
Supervisor VARCHAR2(20),
Disabled VARCHAR2(3),
NextOfKinNo VARCHAR2(9) NOT NULL,
CONSTRAINT Student_PRIMARY_KEY PRIMARY KEY (StudentNo));
CREATE TABLE WaitingList (
StudentNo VARCHAR2(9) NOT NULL,
CurrentStatus VARCHAR2(7),
CONSTRAINT CurrentStatus_PRIMARY_KEY PRIMARY KEY (StudentNo));
The query needs to pick out the Students who have the CurrentStatus attribute in the WaitingList field set at 'Waiting' and for those that do, display the value of their 'Name','HomeStreet','HomeTown','HomeCity','HomePostCode', and 'DepartmentName' attributes from the Student table. Would that mean that I would also have to create some sort of constraint between the 'StudentNumber' attribute on the WaitingList table and 'StudentNumber' attribute on the Student table? They are the Primary Key on both tales. So far I have come up with this:
SELECT * FROM WaitingList WHERE CurrentStatus = 'Waiting';
All this does is display the values of the 'StudentNumber' and 'CurrentStatus' attributes of the WaitingList table whose 'CurrentStatus' has the value 'Waiting'.
Thanks,
Darren
I am trying to do an SQL query involving these 2 tables:
CREATE TABLE Student (
StudentNo VARCHAR2(9) NOT NULL,
StudentType VARCHAR2(13),
FirstName VARCHAR2(20),
SecondName VARCHAR2(20),
Sex VARCHAR2(6),
DateOfBirth DATE,
HomeSteet VARCHAR2(20),
HomeTown VARCHAR2(15),
HomeCity VARCHAR2(15),
HomePostCode VARCHAR2(8),
HomeTeleNo CHAR(15),
ProgramOfStudy VARCHAR2(30),
DepartmentName VARCHAR2(30),
Year VARCHAR2(3),
YearTutor VARCHAR2(20),
Supervisor VARCHAR2(20),
Disabled VARCHAR2(3),
NextOfKinNo VARCHAR2(9) NOT NULL,
CONSTRAINT Student_PRIMARY_KEY PRIMARY KEY (StudentNo));
CREATE TABLE WaitingList (
StudentNo VARCHAR2(9) NOT NULL,
CurrentStatus VARCHAR2(7),
CONSTRAINT CurrentStatus_PRIMARY_KEY PRIMARY KEY (StudentNo));
The query needs to pick out the Students who have the CurrentStatus attribute in the WaitingList field set at 'Waiting' and for those that do, display the value of their 'Name','HomeStreet','HomeTown','HomeCity','HomePostCode', and 'DepartmentName' attributes from the Student table. Would that mean that I would also have to create some sort of constraint between the 'StudentNumber' attribute on the WaitingList table and 'StudentNumber' attribute on the Student table? They are the Primary Key on both tales. So far I have come up with this:
SELECT * FROM WaitingList WHERE CurrentStatus = 'Waiting';
All this does is display the values of the 'StudentNumber' and 'CurrentStatus' attributes of the WaitingList table whose 'CurrentStatus' has the value 'Waiting'.
Thanks,
Darren