SQL (MS Access)
Working on a class assignment and I have just a couple questions here...
1) Is there any way to create multiple tuples and add them to a table using the same Query? If I do the add command and end it with a semi-colon, I get a message about text being after the end of the query; if I dont use a semicolon, it says it expects one after the first "add" statement.
2) Okay, the book gives many examples about relationships. Lets use this for example... say we have Students( sid, age, gpa ), and Enrolled( sid, courseID, grade ).
Now, here's the problem... the book has the following as Primary keys:
Students - sid
Enrolled - sid, courseID
And the following Foreign Key:
Enrolled - sid (References Students)
Now, this causes a problem in my eyes. As it appears, it seems a single student is unable to be "enrolled" in more than one course. It seems to me that when you add a student for the second time to the table to be Enrolled for a course (different courseID) it violates the Primary Key (sid) because that students sid hasn't changed.
For now, I deleted my two Primary Key's in "Enrolled" and just left the Foreign Key to keep the two tables in sync... am I missing something or is the book not compatible with Access's SQL?
Thanks~!
__________________
- Artsemis
~~~~~~~~~~~~~~~~~~~~
There are two keys to being the best:
1.) Never tell everything you know
|