473,804 Members | 2,455 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

db design - the mythical 1:1 relation ?

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:
1) devide the data collumns on n tables
2) enforce the existence of all parts of a record by table design
The best workable way I can think with only two tables is 1:(0,1)
which is not exactly the deal. It provides that table_b can hold 0 or 1
part relating to a part in table_a, by a foreign key in table_b and an
UNIQUE.
I tried another way with
1) creating table_a
2) creating table_b with FK to table_a
3) alter table_a with a FK to table_b

Now that was a 1:1 relation.
Obviously I couldn't insert anymore. A insert in table_a would violate
the existence integrity constraint to table_b.

SET AUTOCOMMIT=0;
SET FOREIGN_KEY_CHE CKS = 0;
insert table_a ...
insert table_b ...
SET FOREIGN_KEY_CHE CKS = 1;
COMMIT;

would let me insert but the inserted data wouldn't be checked at all.
That way I could forget using this relation constraint alltogether.
Are real 1:1 relations mythical beeings that live only between the dusty
covers of db-design textbooks or - more likely - am I just ignorant ?


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 2136

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

Similar topics

36
6413
by: Andrea Griffini | last post by:
I did it. I proposed python as the main language for our next CAD/CAM software because I think that it has all the potential needed for it. I'm not sure yet if the decision will get through, but something I'll need in this case is some experience-based set of rules about how to use python in this context. For example... is defining readonly attributes in classes worth the hassle ? Does duck-typing scale well in complex
20
4898
by: Andy | last post by:
Hi All! General statement: FK should not be nullabe to avoid orphans in DB. Real life: Business rule says that not every record will have a parent. It is implemented as a child record has FK that is null.
3
1457
by: Yves Dhondt | last post by:
Hello, I've got the following UML design : C | A _____|______ B So 2 objects A and B are connected through a relation C. (For example an employment scheme : person A1 worked for company B1 at time C1, person
2
1817
by: PEK | last post by:
I have a database that looks something like this: Table: Creature Fields, CreatureId {PK}, ... Table: Bug Fields: BugId {PK}, CreatureId {FK}... Table: LadyBird Fields: LadyBirdId {PK}, BugId {FK}...
23
2395
by: JoeC | last post by:
I am a self taught programmer and I have figured out most syntax but desigining my programs is a challenge. I realize that there are many ways to design a program but what are some good rules to follow for creating a program? I am writing a map game program. I created several objects: board object that is an array of integers each number 0-5 is a kind of terrain, a terrain object that is an array of terrain types and each number of...
18
2102
by: john | last post by:
I have 3 tables: Message, Workgroup, and Hyperlink. Message has 1xM link with Hyperlink and Workgroup has 1xM link with Hyperlink. Hyperlink has the following fields: IDhyperlink* IDmessage IDworkgroup Name_Hyperlink In most cases either IDmessage or IDworkgroup will have no value. Is this a good approach or should I make 2 Hyperlink tables or...? thanks,
23
2446
by: JohnH | last post by:
I'm just recently come to work for an auto brokerage firm. My position involves performing mysterious rites, rituals and magick in order to get information out of their access database. This is due to the fact that the "designer" they hired had an unfortunate ability to tink around with a program far beyond her reach. She had no concept of any of the principles of database design, so what i'm left with is a junkpile. The only reason I...
2
1290
by: newbie | last post by:
I want the DataAnDRelation is flexible in design so that client code can define its own relationship according to their own needs. I am trying to use function pointer, but that needs client code to declare friendship in the class DataAndRelation, which I feel not neat. Any design pattern/standard way to solve this problem. bool MyRelation(double a, double b) { return a b; }
12
7025
by: nyathancha | last post by:
Hi, I have a question regarding best practices in database design. In a relational database, is it wise/necessary to sometimes create tables that are not related to other tables through a foreign Key relationship or does this always indicate some sort of underlying design flaw. Something that requires a re evaluation of the problem domain? The reason I ask is because in our application, the user can perform x
0
9704
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
9571
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,...
1
10302
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
9132
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
6845
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
5505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2976
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.