473,804 Members | 3,903 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

One-One Relationship

Tom
Hi,
Do you guys know what's wrong with a one-to-one relationship?

The reason I want to make it like this is that at the very end of the chain,
the set of keys is huge. I want to limit the number of columns to be the
key. i.e. the [company] table has 1 column as the key. The [employee]
table will have 2 columns as the key.

e,g,
If I add a [sale] table to the [company]-[employee] relationship, the third
table
will have 3 columns as the key -- "company id", "employee id", and "sale
id".

(e.g.)
I have a company with many employees and computers. But instead of classify
all these, I just want to call all these as an entity. A company is an
entity. An employee is just another entity. etc.

So, instead of a one-to-many:
[company]---*[employee]---*[sale]
|
|
*
[computer]

I make it one-to-one.

[entity]---*[entity]

If I want to know the name and address of the entity "employee", I will have
a 1-to-1 table [employee] to look up the information for this employee
entity.

[entity]---*[entity]
|
|
[company]
|
|
[employee]
|
|
[computer]
|
|
[sale]
--
There is no answer.
There has not been an answer.
There will not be an answer.
That IS the answer!
And I am screwed.
Deadline was due yesterday.

There is no point to life.
THAT IS THE POINT.
And we are screwed.
We will run out of oil soon.

Oct 10 '05
13 1701
>> a primary key should always be a single column <<

Where did you get a stupid idea like that? It was not Dr. Codd, Chris
Date, or anyone else who has written about RDBMS. Can you give ANY
recgonized authority in the field for that statement? Consider
(longitude, latitude) pairs. The only atomic meaning comes from the
pair, not the parts.

Please read any book on RDBMS before you post again.

Oct 12 '05 #11
Actually, I am trying to be HOUSE :)

Or my wife's best Zen teacher ...

Oct 12 '05 #12
What does the "width of a table" mean?? The number of columns or
what?? Physical bytes per row? How do you count VIEWs? etc. You
have no conceptual model at all.

A table should have all the columns needed to make a complete data
model. That is basic data modeling.

Oct 12 '05 #13
In message <11************ **********@g49g 2000cwa.googleg roups.com>,
db*******@hotma il.com writes
set of keys?

a primary key should always be a single column

always always always


Nope. It is what it is. If the object you are modelling requires three
attributes to uniquely identify it then your primary key is made up of
three columns. Database designers don't get to decide what their primary
key is, the data decides and you live with whatever it hands you.

I think what you are thinking of is the practise of adding a surrogate
key to a table that has an inconvenient primary key. Some people always
do that when they face a multi-column key. Personally I avoid surrogate
keys if I can.
--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author.

Oct 12 '05 #14

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

Similar topics

0
2767
by: Alcyone Oliveira | last post by:
------=_NextPart_000_000D_01C36572.F6480CE0 Content-Type: multipart/alternative; boundary="----=_NextPart_001_000E_01C36572.F6480CE0" ------=_NextPart_001_000E_01C36572.F6480CE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
0
1420
by: Mike Sutton | last post by:
Please let me know what you think of this scheme I have come up with (not to imply that noone else has before me) for managing relationships. I have created an entities table with Individual and Organizational subtypes. I need to be able to relate them to eachother (e.g., some are customers of or suppliers to others, some have employer/employee relationships,...). I know this is not an uncommon thing to do. So, I have created...
8
7439
by: Andante.in.Blue | last post by:
Hello, I have just inherited a legacy Access 97 database. While going through it, I noticed something strange... its Relationships window (the one accessed by Tools --> Relationships) is almost empty. Now, as I ponder how a relation database could work without any relationships, I noticed that the queries of the database defined some relationships between the source tables and queries. Which leads me to the question, what is the...
2
3423
by: Larry R Harrison Jr | last post by:
I have an Access 97 database with 2 tables that have a one-many relationship. I have a SQL statement in the "one" table which I want to execute and insert 7 records into the "many" table, and I want them to be linked to the "main" table. Problem is, it won't let me run the SQL run as long as the one-many relationship is established in the relationship window. The SQL is:
7
5105
by: francophone77 | last post by:
I deleted a relationship in the relationship view, but when I create a query that includes those two tables, the relationship reappears. When I go back to the relationship view there is NO relationship but I can't seem to get rid of it for queries (without manually doing it for each query). Can anyone tell me whats going on??? TIA
0
1288
by: Joey Lee | last post by:
Hi, I have created a dataset schema(*.xsd) which contain two element "InvoiceHeader" and "InvoiceDetail". I set the primary key of both the element. for example "InvoiceHeader" -> id and "InvoiceDetail" -> "id, date" Then I created a relationship between both these item using the key "id". This create the one-to-many relationship.
5
2397
by: BrianDP | last post by:
This is a strange one-- I have an Access 2K database with a split front end/back end. There are two tables in the back end - RFile and RLine. There is a one to many relationship from Rfile.Rnumber to Rline.Rnumber. Originally I went in with the Relationships window, drew the line, and clicked the cascading updates and deletes. Everything was fine, for a couple of years. All of the sudden however, this relationship seems to delete...
1
1942
by: BuckBaxter | last post by:
Recently had trouble creating a one-to-many relationship between Customer table and Order table. After drag & dropping the field CustomerNo (key) in Customer table to CustomerNo (foreign) in Order table, the relationship wizard would begin making a one-to-one relationship. After a lot of searching, I still don't know why the wizard thinks I want a one-to-one relationship or how to change that. However, when I deleted the field CustomerNo from...
4
1856
by: Phil Stanton | last post by:
Having spent ages sorting out the layout of my relationship window with about 60 tables and getting it all tidy and with enough of the tables visible to show the PK an FK relaionshipsOn a subseqent occassion, on opening the relationship window, I found all the tables had shrunk so that in most cases, only the table names were visible and the fields could only be seen by "expanding" the table again. I know you can print out the relationship...
6
4063
by: NicoleCartrette | last post by:
Going back to school is easier said than done.. This was posted to an older thread earlier but I don't think it got any attention. Your help is appreciated Professor requires we create a simple database and specified what are to be the primary keys and relationships etc. I have created the four tables and established the neccessary one to many and many to one relationships between primary keys in the tables with the exception of one...
0
9710
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10593
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9163
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7626
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3000
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.