COMU114 - Introduction to Database Development
- Attempt all 3 tasks
- If you can’t work out how to do something, look for similar examples to help you
- Use the resources you have built up through lectures, labs and tutorials
- All course materials are on this website
Where to look...
- Notes
- Table of contents at start of each chapter
- Table of contents for all chapters on website
- Tutorials
- Solutions available on website
- Labs
- Solutions and completed example databases available on website
- Frequently asked questions on this page
- Other sources on the web
- Start with links given on website, e.g. W3Schools
- Books
- Suggested titles listed on website
- Other database and SQL books in library
- Ask for help...
How do I use the Digital Dropbox?
Do I need to use SQL to create my tables? Do I need to use SQL to enter data into my tables?
Q: How do I use the Digital Dropbox
A: Follow these steps:
- Log into Blackboard and select the module
- Select the Course Tools menu option
- Select the Digital Dropbox option
- Click the SEND FILE button (not ADD FILE)

- Fill in a name and comment for your submission and browse to find the file on your computer you want to send, then click the SUBMIT button

Q: Do I need to use SQL to create my tables? Do I need to use SQL to enter data into my tables?
A: Yes, you must use SQL to create tables, and you must save your SQL create table statements?
However, you do not need to use SQL to enter data into your tables?
Q: Why do I get an error like 'Invalid field name <name> in definition of index or relationship' or 'Could not find field' when creating a table with a foreign key?
A: It could be simply because you've misspelled the name of a field.
Or, it could be because you are using a field in your foreign key which exists as the PK of the other table, but does not exist in the table you are creating. A field must exist in the table before you can use it as a foreign key. For example, from the GCUCars database:
CREATE TABLE Hires( startDate DateTime NOT NULL, endDate DateTime, CDWChosen YesNo NOT NULL, startMileage Number NOT NULL, endMileage Number, status Text(10), customerID Long NOT NULL, registration Text(8) NOT NULL, PRIMARY KEY(customerID, registration, startDate), FOREIGN KEY(customerID) REFERENCES Customers(customerID), FOREIGN KEY(registration) REFERENCES Cars(registration) )
Note that the foreign key fields customerID and registration appear as field definitions:
customerID Long NOT NULL, registration Text(8) NOT NULL,
AND in the foreign key definitions:
FOREIGN KEY(customerID) REFERENCES Customers(customerID), FOREIGN KEY(registration) REFERENCES Cars(registration)

