I'm attempting to answer this question: Create a view of all patient details (patient, ward, drugs) for all patients who are 70 years old or older, excluding ward number and number of beds.
From this schema:
Patient (patientNo, patName, patAddr, DOB)
Ward (wardNo, wardName, wardType, noOfBeds)
Contains (patientNo, wardNo, admissionDate)
Drug (drugNo, drugName, costPerUnit)
Prescribed (patientNo, drugNo, unitsPerDay, startDate, finishDate)
The query I have written is:
CREATE VIEW [Patients Over Seventy] AS
SELECT p.*, c.admissionDate, r.drugNo, r.unitsPerDay, r.startDate, r.finishDate
FROM Patient p, Contain c, Prescribed r
WHERE p.patientNo=c.patientNo AND p.DOB <=1952-05-31;
But I keep getting the error: "Query Error: Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[Patients Over Seventy] AS SELECT p.*, c.admissionDate, r.drugNo, r.unitsPerDay,' at line 1"
What am I getting wrong here?
[]characters, but try withCREATE VIEW Patients_Over_Seventy ...instead.