Level – National 5+
Checking for Correctness
As you have been creating tables, the SQL command to create that table has been displayed at the bottom of the “Edit table definition” window:
Note: Quotation marks may have been added to table/field names, and any other text.
Compare this with every item on your data dictionary:
- Are your field names correct?
- Are the data types correct?
- Is there a Primary key?
- Is the Primary key Unique?
- Is the Primary key Not Null?
- Are foreign keys connected to the correct table and field?
- Are required fields set to “Not Null”?
- Are your length checks correct?
- Are your range checks correct?
- Are your restricted choice checks correct?
Printing Evidence
This DDL code can copied and pasted into a Word document, but it will lose any autoformatting:
CREATE TABLE "appointments" ( "appointment_id" INTEGER, "customer_id" INTEGER, "date" TEXT, "time" TEXT, "completed" NUMERIC, FOREIGN KEY("customer_id") REFERENCES "customers"("customer_id") );
Using the Snipping Tool will keep the autoformatting, making it easier to read: