473,395 Members | 1,554 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,395 software developers and data experts.

Table Relationshp Question

I have a simple database with 3 tables, Companies, Contacts and
Indusrty.

Companies
CompanyID (Primary Key) CompanyName Industry

Contacts
ContactID (Primary Key) FirstName CompanyiD

Industry
Industry (Primary ID)

There is a One to Many relationship between

Companies.CompanyID and Contacts.CompanyID

Industry.Industry and Companies.Industry.

I have enabled cascasding deletions for both relationships.

When I delete a company all related contacts are deleted, as expected.
However it does not delete the industry from the Industry table
(assuming the industry is only assigned to that one company I am
deleting. Am I mis-understanding how this works? It works they way I
expect it to between companies and contacts but not Companies and
Industry table. Am I missing something here?

Thanks.
Nov 12 '05 #1
2 1159
Cascade Delete only works when you try to delete a record on the 1 side of a 1-M
relationship not when you try to delete a record on the M side. Industry in
Companies is on the M side so you get no cascade delete. If you would try to
delete Industry in the Industry table, cascade would work and delete all company
records that contained that Industry value. BTW, the cascade would carry forward
and delete the Contacts associated with the companies that were being deleted.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Robert" <Ro************@PJSolomon.Com> wrote in message
news:60*************************@posting.google.co m...
I have a simple database with 3 tables, Companies, Contacts and
Indusrty.

Companies
CompanyID (Primary Key) CompanyName Industry

Contacts
ContactID (Primary Key) FirstName CompanyiD

Industry
Industry (Primary ID)

There is a One to Many relationship between

Companies.CompanyID and Contacts.CompanyID

Industry.Industry and Companies.Industry.

I have enabled cascasding deletions for both relationships.

When I delete a company all related contacts are deleted, as expected.
However it does not delete the industry from the Industry table
(assuming the industry is only assigned to that one company I am
deleting. Am I mis-understanding how this works? It works they way I
expect it to between companies and contacts but not Companies and
Industry table. Am I missing something here?

Thanks.

Nov 12 '05 #2
Is the relationship between Industry & Company the correct way around?

The deletion will cascade "down" the relationships, not "up". If Industry is
a parent of Company... if you delete an Industry record it would delete all
associated Companies and Contacts.

What if the Industry is used by a different Company record? That is why it
won't be removed.
--
Bradley
Software Developer www.hrsystems.com.au
A Christian Response www.pastornet.net.au/response
"Robert" <Ro************@PJSolomon.Com> wrote in message
news:60*************************@posting.google.co m...
I have a simple database with 3 tables, Companies, Contacts and
Indusrty.

Companies
CompanyID (Primary Key) CompanyName Industry

Contacts
ContactID (Primary Key) FirstName CompanyiD

Industry
Industry (Primary ID)

There is a One to Many relationship between

Companies.CompanyID and Contacts.CompanyID

Industry.Industry and Companies.Industry.

I have enabled cascasding deletions for both relationships.

When I delete a company all related contacts are deleted, as expected.
However it does not delete the industry from the Industry table
(assuming the industry is only assigned to that one company I am
deleting. Am I mis-understanding how this works? It works they way I
expect it to between companies and contacts but not Companies and
Industry table. Am I missing something here?

Thanks.

Nov 12 '05 #3

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

Similar topics

2
by: A. Wiebenga | last post by:
Hi all! I am currently involved in a project in which I am supposed to write a XSLT-transformation sheet for some XML data. I will outline the situation first: I've got one large XML file...
1
by: Eric | last post by:
Hello, I'm sure your all tired of these "alignment" question, but please endure mine. Question. Simple put: What makes a table sit beside another table, as oppose to going down below it. ...
5
by: Sami | last post by:
Please bear with me, and if you answer this question, please do it step by step. I am new at Access, not at all sophisticated. I am using Office XP. This will need to be read in Access for...
3
by: CAD Fiend | last post by:
Hello, I have a land development project that has a many-to-many relationship. I have ONE question regarding table structures, and ONE question on how to make a Form with two Subforms, below. ...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
1
by: LurfysMa | last post by:
I am working on an electronic flashcard program. Most of the subjects are simple lists of questions and answers. Those seem to be working. Some of the "subjects" have "categories" of questions. ...
9
by: sck10 | last post by:
Hello, I am building a web form that will be used to gather information for marketing plans. The form will have 15 questions which must be answered. Each question can have large blocks of text....
2
by: mmitchell_houston | last post by:
I'm working on a .NET project and I need a single query to return a result set from three related tables in Access 2003, and I'm having trouble getting the results I want. The details: ...
2
by: servantofone | last post by:
I'm running Access 2003 on Windows XP. This is more of a developmental/implementation type of question. I have a form which requires answers to 35 different questions. All questions are answered...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.