SQL , PLEASE OBSERVE THE SQL SCRIPT . I need to create 3 tables and input some v
ID: 3702508 • Letter: S
Question
SQL , PLEASE OBSERVE THE SQL SCRIPT .
I need to create 3 tables and input some values into them . However I am trying to execute the following script into Oracle SQL developer but i am getting a lot of errors such as :
"Error starting at line : 9 in command -
CREATE TABLE Doctor(
DoctorName varchar(100),
Gender varchar(100),
RegistrationNumber varchar(100),
Qualification varchar(100)
PRIMARY KEY (DoctorName)
)
Error report -
ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:
"
and
"Error starting at line : 17 in command -
CREATE TABLE Patient(
PatientName varchar(100),
Gender varchar(100),
DOB date,
Address varchar(100),
PhoneNumber int,
PRIMARY KEY (PatientName)
)
Error report -
ORA-00955: name is already used by an existing object
00955. 00000 - "name is already used by an existing object"
*Cause:
*Action:"
and many more....
Please help and fix it for me . thank you.
CREATE TABLE Doctor( DoctorName varchar(100), Gender varchar(100), RegistrationNumber varchar(100), Qualification varchar(100) PRIMARY KEY (DoctorName) CREATE TABLE Patient( PatientName varchar(100), Gender varchar(100), DOB date, Address varchar(100), PhoneNumber int, PRIMARY KEY (PatientName) CREATE TABLE Appointments( DoctorName varchar(100), PatientName varchar(100), AppointmentDate date AppointmentTime time, type varchar(100), primary key (DoctorName,PatientName), foreign key (DoctorName) REFERENCES Doctor(DoctorName) foreign key (PatientName) REFERENCES Patient(PatientName) insert into Doctor values(Steven Arrow,M, ABC001', Bachelor of Medicine and Surgery,Deakin University,1980), insert into Doctor values(Steven Arrow,M, ABC001', Bachelor of Medicine and Surgery,Deakin University,1980") insert into Doctor values(Steven Arrow,M, ABC001', Bachelor of Medicine and Surgery,Deakin University,1980), insert into Doctor values(Stanley Bill, M,AXG809, Bachelor of Medical Science, The University of Melbourne, 1982); insert into Doctor values(Stanley Bill, M,AXG809,"Bachelor of Medical Science, The University of Melbourne, 1982); insert into Doctor values(Stanley Bill, M,AXG809, Bachelor of Medical Science, The University of Melbourne, 1982); insert into Doctor values("Kate Cox,'F,'BIT001, Master of Clinical Medicine,Monash University,2000"); insert into Doctor values("Kate Cox,'F,'BIT001, Master of Clinical Medicine,Monash University,2000"); insert into Doctor values(Max Fat, M,'BM3,Master of Medicine,The University of Melbourne,2000) insert into Doctor values(Max Fat, M,'BM3,Master of Medicine, The University of Melbourne,2000) insert into Patient values( Will Smith', M, 1965-12-15, 3 Farmer Street,Melbourne,3001,30001234); insert into Patient values("Jade Liew,'F, 1970-01-10,15 Happy Lane,Prahan,3015',15001234); insert into Patient values(Alex Lade, M, 1965-12-15,7 Storey Drive,Perston,3147, 70001965') insert into Patient values('Emily Moo','F, 1980-04-04,109 Cardigan Street,Carlton,3003,'10901980), insert into Patient values("Bob Jane',M, 2001-05-12,23 Tmart Street,Malven,3145', 23002001), insert into Patient values(Daniel Water, M, 1980-10-19,45 Water Lane,Fitzroy,3078,45001980) insert into Patient values(Arran May,M, 1998-04-20', 26 May Street,Kew,3125', 26001998); insert into Appointments values(Steven Arrow, Will Smith', 2017-04-15,'10:00',long) insert into Appointments values(Steven Arrow, Jade Liew,2017-04-15',10:30, short) insert into Appointments values(Steven Arrow,'Alex Lade, 2017-05-28, 14:00',long) insert into Appointments values(Stanley Billll Smith', 2017-05-20',15:00','short) insert into Appointments values(Stanley Bill' 'Emily Moo','2017-05-11, 10:30,long), insert into Appointments values(Stanley Bill, Bob Jane', 2017-06-06', 09:30, short), insert into Appointments values(Kate Cox, Will Smith', 2017-06-30", 14:00','long') insert into Appointments values(Kate Cox,'Daniel Water, '2017-06-30,15:30', short) insert into Appointments values(Max Fat, Arran May', 2017-04-28','16:00, short) insert into Appointments values(Max Fat, Alex Lade', 2017-04-30', 13:00', short),Explanation / Answer
Syntax for Doctor Table:
create table Doctor(DoctorName varchar(100),Gender varchar(100),RegistrationNumber varchar(100),Qualification varchar(100),PRIMARYKEY(DoctorName));
Syntax for Patient Table:
create table Patient(PatientName varchar(100),PatientGender varchar(100),DOB date,Address varchar(100),PhoneNumber int,PRIMARYKEY(PatientName));
Syntax for Appointments Table:
Create table Appointments(DoctorName varchar(100),PatientName varchar(100),AppointmentDate date,AppointmentTime time,type varchar(100),primarykey(DoctorName,PatientName),foreign key DoctorName REFERENCES Doctor(Doctorname),foreign key PatientName REFERENCES Patient(PatientName) );
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.