473,385 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to change the relationship between a primary key and foriegn key?

Hey there,

Im not even sure if im using the terminology correctly. Anyway heres
my questions. I have a three tables. The main table has two ID fields.
A website id, which is the primary key in that table, and a
SupplierID.

In the second table, websiteID is not the primary key, so when i want
to relate the table above with this one, its always 1 to many. I need
this to be 1 to 1. what can i do here.

In the third table, the primary key is SupplierID, which is related to
the first table. again the relationship is 1 to many, and i need it to
be one to one.

Also, with the remaining tables, where the relationships are all 1 to
1, each "sub" table displays the correct information from main table.
I need to do this with the table ive just mentioned. is it possible?

regards
adham

May 28 '07 #1
1 1364
On May 28, 3:33 pm, adham <adhamsel...@yahoo.comwrote:
Hey there,

Im not even sure if im using the terminology correctly. Anyway heres
my questions. I have a three tables. The main table has two ID fields.
A website id, which is the primary key in that table, and a
SupplierID.

In the second table, websiteID is not the primary key, so when i want
to relate the table above with this one, its always 1 to many. I need
this to be 1 to 1. what can i do here.

In the third table, the primary key is SupplierID, which is related to
the first table. again the relationship is 1 to many, and i need it to
be one to one.

Also, with the remaining tables, where the relationships are all 1 to
1, each "sub" table displays the correct information from main table.
I need to do this with the table ive just mentioned. is it possible?

regards
adham
Do a search on "one to one relationship" in this group. You will find
you need to adjust your thinking in the use of one to one
relationships.

If you want a one to one relationship between tables just give the
primary key in both tables the same name:
tblTable1.lngPrimaryID
tblTable2.lngPrimaryID
May 30 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Girish Agarwal | last post by:
Hi All, I have a database consisting of 2 tables. patient_info ( Patient Information ).Looks like lastname VARCHAR(10) fname VARCHAR(10) ssno INT(9) PRIMARY KEY ID INT(4) AUTO_INCREMENT ...
0
by: Girish Agarwal | last post by:
--0-474210375-1058976151=:31789 Content-Type: text/plain; charset=us-ascii Content-Id: Content-Disposition: inline Note: forwarded message attached. __________________________________
1
by: Lannsjo | last post by:
I need to change my primary key column type from smallint to int. I have tried: ALTER TABLE livegroup MODIFY id INT UNSIGNED NOT NULL AUTO_INCREMENT; But get an error message certainly since my...
4
by: Omey Samaroo | last post by:
I am using Employee_Number as a primary field in one table and in another table I have a field with the same name that it references in a one to many relationship. How do I change the primary field...
3
by: Rick Kay | last post by:
I have a table that has a Primary key and a foreign key. The primary key is NOT an Identity field, however, the foreign key is. I would like to know if there is a way to have the foreign key reset...
2
by: sajithamol | last post by:
How to change the primary key for already existing table?
4
by: PW | last post by:
Hi, I set up a relationship between two tables with the itineraryid fields in both tables: tblDailyItinerary tblDailyMeals I have a form that writes a record to tblDailyItinerary that...
14
beacon
by: beacon | last post by:
Hi everybody, I'm having trouble normalizing or setting up relationships for my tables. Here's what I've got so far: tblPatients: PatientPrimary# (Number) PatientSecondary# (Text) ...
19
by: Jimgunkel | last post by:
Is there a way to change my primary key in Access using ASP? My primary key looks like this: 1101001CXR001MS01-01 thru 1101001CXR001MS01-24 I want to change MS01 to MS04. <%
0
by: newnauk | last post by:
I've creatd an ADO.NET app that reads from an MS Access database and I like to modify the primary keys of all the data tables before copying them over to another DB server. When you change the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.