Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Design of database table and PK update Expand / Collapse
Author
Message
Posted Tuesday, March 19, 2013 6:05 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 10:35 AM
Points: 1,786, Visits: 3,239
We are creating an address database to maintain student address info.

I have two tables like this :

The address table is a master table that holds all addresses. The studHomeAddress table will hold all students and their address- the addressID comes from the master address table. The primary key of the Address table is Address ID, the PK for studHomeAddress table is studentID and AddressID,

we are going to have a screen for user to add or edit for each of the two tables.

They can add and edit records, for both of the tables.

For the first table Address, I think it is no problem. For the second table, if we want to change the address of the student to another one, then the AddressID will be changed for this record, but it is the PK, the PK for the row will be changed. Is that an OK design?

Thanks,

Post #1432951
Posted Tuesday, March 19, 2013 6:11 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 8:55 AM
Points: 2,873, Visits: 5,185
I guess your StudentAddress table is a link table between Address and Student tables, right?
If so, when you edit the link you better delete and insert "link" rows if they change, not update them.


_____________________________________________
"The only true wisdom is in knowing you know nothing"
"O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!"
(So many miracle inventions provided by MS to us...)

How to post your question to get the best and quick help
Post #1432954
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse