What does this mean -> "Specify the SQL statement that would define the table, AND maintain referential integrity?"
Just looking through some past papers prior to my SQL exam and came across this gem, can someone please explain what is being asked here as it is confusing me. I don't really understand what is being asked, and what is meant by "specify the SQL statement that would define the table".
I understand referential integrity, I believe. It just means that if a value is stored in one table and then referenced in another, they must be the same.
How does that apply to this question ?
Thanks a lot开发者_Python百科 :)
The question is asking you to write a CREATE TABLE statement with the appropriate constraints to maintain RI against some set of foreign keys. Since you haven't provided the complete question it's hard to know exactly what is wanted.
I would imagine they want some DDL that includes a foreign key definition. e.g. something like
CREATE TABLE YourTable
(
bar int not null primary key,
foo int not null references othertable(foo)
)
精彩评论