I am new to database design and a lot of things never made any sense to me regarding relationships and such. I have been working on a very large design that started out well enough, but as tables were added a lot of organization fell by the wayside. Now that I am getting closer to the end, I am finding a lot of places where there should be Foreign keys, maybe some triggers, etc (I have the same data item in 5 different places, when it is deleted in one place it must go from all). Assuming that the datatypes and sizes are identical for the duplicated bits of data, can I go about making FK-PK relationships and such now that there is a lot of stuff in the database, or do I have to start from scratch and rebuild the whole thing.
The other question is much more simple:
How do I make multiple rows "unique". I have a primary key, and an identity column, but I can't add a secong primary key, and Enterprise Manager only lets me make 'int' datatypes identity columns. I have tried the "add constraints" but it asks for an expression and I have no idea what the syntax might be.
Any help is appreciated.Try downloading AdventureWorks for SQL Server 2000 from the first link, copy the installation file into Query Analyzer and execute it. It is an 87 table Database using the Peter Chen ERD model. The second is PPT slides with the book used to create it, only 143 pages but it has a lot of sample Catalogs that will make things a little easier for you. The book is dry and abstract. Hope this helps.
http://www.microsoft.com/downloads/details.aspx?familyid=487c9c23-2356-436e-94a8-2bfb66f0abdc&languageid=f49e8428-7071-4979-8a67-3cffcb0c2524&displaylang=en
http://wings.buffalo.edu/mgmt/courses/mgtsand/data.html
Kind regards,
Gift Peddie
没有评论:
发表评论