473,791 Members | 3,059 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

one to one relation

Hi,

I've got two tables (both with a primary key) which are related
through a one-to-one relation (for security reasons). Both tables
store information about people. The information in the first table
should be accessible for everyone, while the information in the second
table should only be accessible to a select group of users. So the
setup is something like this:

Table 1 Table 2
id | Name | Adres | etc | |id | bankaccount | etc.

I turned referential integrity on. However, when I try to turn on
"Cascade update related fields", I get an error: Invalid field
definition "Id" in definition of index or relationship. What am I
doing wrong here?

(*) With referential integrity on I can't add a person in the second
table, without adding him/her in the first. That's good!

However, when I add a name to the first table, but do not fill in the
one of colums of the second table (eg bankacount), and I run a select
query on the people stored in the first table, this newly created
person does not show up in the select query. How can this be solved?

Of course I can circumvent this problem by demanding that at least one
of the colums of the second table is filled in? Is it possible to
achieve something opposite to (*) without giving op (*) itself?
Nov 13 '05 #1
2 1717
With your select query include both table1 and table2 and do a left join
from table1 to table2
SELECT Table1.ID, Table2.BankAcco unt
FROM Table1 LEFT JOIN Table1.ID = Table2.ID;

This will show all the people in table even if the ID hasn't been entered
into table2. If you only want to display the people whose bankaccount
numbers are not entered, add to the above SQL statement by first removing
the ";"
WHERE Table2.BankAcco unt Is Null;

Stewart
"auke" <a.***********@ its.tudelft.nl> wrote in message
news:4d******** *************** ***@posting.goo gle.com...
Hi,

I've got two tables (both with a primary key) which are related
through a one-to-one relation (for security reasons). Both tables
store information about people. The information in the first table
should be accessible for everyone, while the information in the second
table should only be accessible to a select group of users. So the
setup is something like this:

Table 1 Table 2
id | Name | Adres | etc | |id | bankaccount | etc.

I turned referential integrity on. However, when I try to turn on
"Cascade update related fields", I get an error: Invalid field
definition "Id" in definition of index or relationship. What am I
doing wrong here?

(*) With referential integrity on I can't add a person in the second
table, without adding him/her in the first. That's good!

However, when I add a name to the first table, but do not fill in the
one of colums of the second table (eg bankacount), and I run a select
query on the people stored in the first table, this newly created
person does not show up in the select query. How can this be solved?

Of course I can circumvent this problem by demanding that at least one
of the colums of the second table is filled in? Is it possible to
achieve something opposite to (*) without giving op (*) itself?

Nov 13 '05 #2
Thanks,

I set only the DEFAULT value. But this setting does not effect joins
created earlier (stupid me). So I had to go to relations and edit the
relation again!

That did the trick!!

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3

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

Similar topics

0
2135
by: Andreas | last post by:
Hi folks, how would you design a 1:1 relation ? I'd like to split an entities's attributes because they won't get equally frequently requested. So I can save memory and disk access time. The integrity of the splitted record should be retained. The key points would be:
3
11386
by: Terrence Brannon | last post by:
I don't know what Postgres considers a relation and had no intention of creating one when piping my schema to it... I always DROP TABLE before CREATE TABLE, so here are the ERRORS emitted when building the database: 3:ERROR: table "country" does not exist 6:ERROR: table "customer" does not exist 11:ERROR: table "product" does not exist 15:ERROR: table "license" does not exist 19:ERROR: table "enduser" does not exist 24:ERROR: ...
2
2038
by: deko | last post by:
ALTER TABLE DROP CONSTRAINT ; Is this syntax correct? The error I'm getting is: Error Number 3199: Could not find reference. I tried it without the curly braces, but no luck.
6
1628
by: Brian Henry | last post by:
Here's an example of the code.. I have two combo boxes on screen that when one's selection is change the other's items will be updated to reflect the change (based on a relation) Private ds_formData As New DataSet ' ' Fill Line Of Business ' cmd_selectCommand.CommandText = "BENESP_GetLinesOfBusiness" da_formData.FillSchema(ds_formData, SchemaType.Source, "LinesOfBusiness")
5
2631
by: Corno | last post by:
Hi all, If I want to provide a typed dataset from a webservice and if that dataset has relations that are nested (isNested=True), then the relations(keyrefs) are not available in the XSD that is offered. If I set IsNested to false or default, then it is included in the XSD. Is this a bug or by design? Corno
7
2743
by: Juris Krumins | last post by:
I have a problem with postgresql tables. periodicaly, I would say frequently about 5-10 time per hour i have such errors in my server log file: 2004-04-14 12:23:32 ERROR: cache lookup of relation 149064743 failed 2004-04-14 12:23:32 ERROR: Relation "tmp_table1" does not exist 2004-04-14 12:23:32 ERROR: Relation "tmp_table1" does not exist So turn on debugging options and have that's what i got:
0
2913
by: Ambica Jain | last post by:
I have a data grid called Files, which has some columns like FileName, Col1, Col2, ... , Col8. Then i have a combobox which allows user to select from Col1 to Col8 and based on this selection, i generate a report from data in grid Files. It displays like (e.g. is Col1 is selected): Col1 Count ---------------------- Val1 x Val2 y .....
1
2821
by: Tim Kelley | last post by:
I have two tables that are linked by 2 fields (ID1 and ID2). Is it possible to create this relation once the tables are in a DataSet? I can create a relation using a single field, but I don't know if this is possible with multiple fields. Thanks,
4
5113
bugboy
by: bugboy | last post by:
I'm inserting a new word into table 'w' and a definition into table 'c' which are linked in table 's' which is the relation table for the many to many relationship between 'w' and 'c'. I've been passed 2 variables from a form; $word and $def and i'm inserting them ok but i'm having trouble getting and passing on their ID's in order to insert them into the relation table 's' I've checked every query and they all work individually, so i...
9
1537
by: Miro | last post by:
VS2008 I have created 3 tables. Vendors Customers PhoneNumbers each have their own key Vendor has: VendorID - int unique identifier Customer has: CustomerID - int unique identifier
0
9666
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
9512
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10419
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
10201
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...
1
10147
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9023
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...
0
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2910
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.