(parent_table <- child_table) idea in sql server databse?
in my Oracle db I can have PK of child_table as FK from parent_table: let's
have shop with shoes, selling shoes, and foosd as well. Example of keys in
my tables:
Product (=parent_table)
----
1
2
3
4
5
Food (=child_table)
----
2
3
4
Shoes (=child_table)
----
1
5
Is that good idea, or not, and may I have the same in SQLServer (2005) ?
(and, what about administrative aspects (like
performance/concurency/updating ..) of generalization in RDMS?)
regardsfireball wrote:
Quote:
Originally Posted by
please help, I need professional approach how to realize generalization
(parent_table <- child_table) idea in sql server databse?
>
in my Oracle db I can have PK of child_table as FK from parent_table: let's
have shop with shoes, selling shoes, and foosd as well. Example of keys in
my tables:
>
Product (=parent_table)
----
1
2
3
4
5
>
Food (=child_table)
----
2
3
4
>
Shoes (=child_table)
----
1
5
>
Is that good idea, or not, and may I have the same in SQLServer (2005) ?
(and, what about administrative aspects (like
performance/concurency/updating ..) of generalization in RDMS?)
>
>
>
>
regards
The syntax is the same in SQL Server and Oracle (and other SQL DBMSs as
well):
CREATE TABLE Product (sku INT NOT NULL PRIMARY KEY);
CREATE TABLE Food (sku INT NOT NULL PRIMARY KEY REFERENCES Product
(sku));
CREATE TABLE Shoes (sku INT NOT NULL PRIMARY KEY REFERENCES Product
(sku));
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/...US,SQL.90).aspx
--
No comments:
Post a Comment