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

Which RDBMS checks 1-1 relationship validity?

I mean: which RDBMS

1) allows to declare that relationship is in fact 1-1, and
2) protests when one tries to violate the 1-1 relationship,
that is inserts into a table two records with the same
foreign key?

Thank you in advance.

Marek Kotowski
Warsaw
Jul 20 '05 #1
5 1785
Marek Kotowski wrote:
I mean: which RDBMS

1) allows to declare that relationship is in fact 1-1, and
2) protests when one tries to violate the 1-1 relationship,
that is inserts into a table two records with the same
foreign key?


Create a unique index on your foreign key field.

And remember that in MySQL enforces foreign key references only if the
table is stored as an InnoDB table.

Regards,
Bill K.
Jul 20 '05 #2
Bill Karwin <bi**@karwin.com> wrote in message news:<ck********@enews2.newsguy.com>...

Thank you for the answer.

Create a unique index on your foreign key field.
I was thinking about specifing 1-1 relationship
in CREATE or ALTER TABLE.

And remember that in MySQL enforces foreign key references only if the
table is stored as an InnoDB table.


I know that. AFAIK in 5.0 MyISAM will have the RI enforcing option
as well.

Regards

Marek Kotowski
Warsaw
Jul 20 '05 #3
Marek Kotowski wrote:
I was thinking about specifing 1-1 relationship
in CREATE or ALTER TABLE.


You _can_ say "CONSTRAINT UNIQUE (columnName)" in a CREATE or ALTER
TABLE statement.
Read about it at: http://dev.mysql.com/doc/mysql/en/CREATE_TABLE.html

But I think I know what you mean, you want some other syntax that is
specific to 1-1 relationships. No, I don't think there is such syntax.

Regards,
Bill K.
Jul 20 '05 #4
Bill Karwin <bi**@karwin.com> wrote in message news:<ck*********@enews3.newsguy.com>...
Marek Kotowski wrote:
I was thinking about specifing 1-1 relationship
in CREATE or ALTER TABLE.
You _can_ say "CONSTRAINT UNIQUE (columnName)" in a CREATE or ALTER
TABLE statement.
Read about it at: http://dev.mysql.com/doc/mysql/en/CREATE_TABLE.html

But I think I know what you mean, you want some other syntax that is
specific to 1-1 relationships.


Exactly.
No, I don't think there is such syntax.
It'a pity. May be next SQL standard will propose
such formal syntax.

Regards

Marek Kotowski
Warsaw
Regards,
Bill K.

Jul 20 '05 #5
Marek Kotowski wrote:
No, I don't think there is such syntax.


It'a pity. May be next SQL standard will propose
such formal syntax.


Well, there's no SQL syntax that explicitly declares a one-to-many or a
many-to-many relationship either. SQL has language the describe the
physical implementation of a relational database. What you're
describing is like an Entity Relationship diagram that describes the
_logical_ relationships, and then enables you to generates a database
based on that.

In fact, there exist several software products that do this.
For instance:
http://solutions.mysql.com/search.php?q=diagram

Regards,
Bill K.
Jul 20 '05 #6

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

Similar topics

2
by: Hari Om | last post by:
I am using Oracle 9.2.0.1 on IBM AIX 5.1 box. It seems that when I install ORACLE, it gets FULLY LOADED with all the SCHEMA's - wonder why. Following SCHEMAS are availavle when I checke din OEM -...
1
by: Marek Kotowski | last post by:
I'm preparing short dictionary and this is the question: are 'RDBMS' and 'database server' synonyms? If not, what are the differences? Thanx in advance. Regards Marek Kotowski Warsaw
3
by: Jason | last post by:
Suppose you have two (or more) tables with foreign key constraints. My question is thus: Is it better to check if the fk exists before you try to perform the insert or let SQL do it for you? ...
17
by: lawrence | last post by:
How is it possible that the question "How do I detect which browser the user has" is missing from this FAQ: http://www.faqts.com/knowledge_base/index.phtml/fid/125 and is only here on this...
4
by: cartoonsmart | last post by:
My problem is described here in detail http://members.home.nl/cartoonsmart/ any help, suggestions are very welcome K.R
122
by: seberino | last post by:
I'm interested in knowing which Python web framework is most like Ruby on Rails. I've heard of Subway and Django. Are there other Rails clones in Python land I don't know about? Which one...
43
by: sinister | last post by:
Is MS Access a true RDBMS?
1
by: Rasheed | last post by:
We are building a smart client application (.NET 2.0) which uses Web Services to access the business objects. Services: The Web Services have been secured by brokered authentication using X509...
9
by: Andy Dingley | last post by:
Here's a chunk of a longer piece of punditry I'm working on, re: the choices between doctypes for authoring and the State of the Union for validity. I've got a bucketload of nasty code and a bunch...
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: 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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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,...

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.