sql tables

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 4

CREATE Table Student

(netId Varchar2(20) NOT NULL PRIMARY KEY,


surname CHAR(15) NOT NULL,
forenames CHAR(20) NOT NULL,
cCode CHAR(5),
cYear NUMBER(4) NOT NULL,
dob DATE);

insert into student (netid, surname, forenames,ccode,cyear,dob)


values ('JENKINS_T','JENKINS','TRICIA','S1022',2,'12-MAR-1980');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('JUBAIL_A','JUBAIL','AMIR','S1022',2,'19-SEP-1981');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('PATEL_V','PATEL','VINNIE','S1022',2,'08-JAN-1984');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('STEVENSON_J','STEVENSON','JACKIE','S1022',2,'31-MAR-1983');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('PAPADOPOLOUS_G','PAPADOPOLOUS','GEORGIO','S1022',2,'14-APR-1981');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('DERMOTT_A','DERMOTT','ALAN','S1022',2,'02-DEC-1984');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('SIMPSON_T','SIMPSON','TONY','S1022',2,'12-MAR-1983');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('SHAH_T','SHAH','TOQIR','S1022',2,'20-OCT-1980');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('TORRENS_V','TORRENS','VANESSA','S1022',2,'08-FEB-1981');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('STICH_M','STICH','MICHAEL','S1022',2,'27-AUG-1975');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('SIMPSON_P','SIMPSON','PENNY','S1032',2,'12-MAR-1983');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('MARKS_N','MARKS','NATASHA','S1022',2,'23-JUN-1979');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('McCLEAN_K','McCLEAN','KEITH','S1032',2,'12-JUN-1981');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('YOUNG_K','YOUNG','KAREN','S1032',2,'30-DEC-1980');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('BHATTI_S','BHATTI','SABERA','S1032',2,'01-FEB-1978');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('JENKINSON_F','JENKINSON','FIONA','S1032',2,'09-SEP-1982');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('PRICE_S','PRICE','STEVE','S1042',2,'12-OCT-1981');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('EVANS_T','EVANS','TRICIA','S1042',2,'22-JUL-1984');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('THOMSON_B','THOMSON','BRIAN','S1043',3,'08-OCT-1982');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('PHILLIPS_S','PHILLIPS','SUE','S1043',3,'22-APR-1983');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('DAVIES_H','DAVIES','HUW','S1023',3,'02-JAN-1979');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('ADAMS_R','ADAMS','ROBERT','S1023',3,'31-MAR-1982');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('CHENG_X','CHENG','XIO','S1022',2,'09-DEC-1978');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('JAMESON_B','JAMESON','BARRY','S1043',3,'14-FEB-1983');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('DANIELS_V','DANIELS','VANESSA','S1043',3,'01-MAY-1984');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('FURLONG_S','FURLONG','SARAH','S1023',3,'19-AUG-1982');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('HARRIS_S','HARRIS','SONIA','S1042',2,'08-MAY-1984');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('SMITH_W','SMITH','BILL','S1052',2,'22-JAN-1973');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('TAYLOR_C','TAYLOR','COLIN','S1043',3,'10-SEP-1982');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('JACOBS_F','JACOBS','FIONA','S1053',3,'20-MAY-1981');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('VORAJEE_I','VORAJEE','IMRAN','S1043',3,'04-JUN-1982');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('YUNG_C','YUNG','CHIANG','S1022',2,'14-FEB-1981');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('MCINTYRE_J','MCINTYRE','JAMIE','S1043',2,'17-OCT-1979');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('POOLE_K','POOLE','KIM','S1053',3,'19-NOV-1980');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('STEELE_T','STEELE','TREVOR','S1042',2,'02-MAR-1984');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('KING_P','KING','PATTRICIA','S1032',2,'22-MAY-1984');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('BURROWS_D','BURROWS','DAVID','S1043',3,'31-OCT-1981');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('ESTABAL_J','ESTABAL','JOSE','S1033',3,'03-SEP-1983');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('MACPHERSON_S','MACPHERSON','STEVE','S1043',3,'12-JUL-1981');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('TURNER_G','TURNER','GILLIAN','S1032',2,'08-FEB-1981');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('FARROW_P','FARROW','PETER','S1023',3,'01-JAN-1980');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('ROUTLEDGE_N','ROUTLEDGE','NICOLA','S1042',2,'13-APR-1982');
insert into student (netid, surname, forenames,ccode,cyear,dob)
values ('GONZALES_A','GONZALES','AMANDA','S1043',2,'14-MAR-1977');

CREATE Table Assessment


(aCode Varchar2(10) NOT NULL PRIMARY KEY,
moduleCode CHAR(6) NOT NULL,
type CHAR(20),
weighting NUMBER(1) NOT NULL,
author CHAR(20) NOT NULL,
dateOfAssessment DATE);

insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)


values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');
insert into Assessment(aCode, moduleCode, type,weighting,author,dateOfAssessment)
values ('46452','CO2701','COURSEWORK','0.50','ZIMIN','12-DEC-2019');
values ('46454','CO2701','EXAMINATION','0.50','ZIMIN','12-MAR-2019');

CREATE Table Result


(rNo NUMBER(5) NOT NULL PRIMARY KEY,
netId Varchar2(20) NOT NULL References Student (netId),
aCode Varchar2(10) NOT NULL References Assessment (aCode),
mark NUMBER(4) NOT NULL,
marker CHAR(20),
primary key (rNo,netId,aCode));

You might also like