473,796 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can FK be nullable/optional by design?

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.

It works, and it is simpler.
The design that satisfy business rule and FK not null can be
implemented but it will be more complicated.

Example: There are clients. A client might belong to only one group.

Case A.
Group(GroupID PK, Name,Code…)
Client(ClientID PK, Name, GroupID FK NULL)
Case B(more cleaner)
Group(GroupID PK, Name, GroupCode…)

Client (ClientID PK, Name, ….)
Subtype:
GroupedClient (PersonID PK/FK, GroupID FK NOT NULL)

There is one more entity in Case B and it will require an additional
join in compare with caseA
Example: Select all clients that belongs to any group
Summary Q: Is it worth to go with CaseB?

Thank you in advance
Jul 20 '05
20 4897
"Tobes (Breath)" <to************ ****@breathemai l.net> wrote in message
news:br******** ****@ID-131901.news.uni-berlin.de...

"Bob Badour" <bb*****@golden .net> wrote in message
news:ao******** ************@go lden.net...
Your list of "fundamenta ls" does not answer any of the questions "What is data?", "What does it mean to manage data?" or "What principles facilitate or guide effective data management?"
In that case I'd be interested in learning some of these fundamentals. I

may have to take myself to the library...
Try to find a library with a copy of the ISO/IEC Standard Vocabularies for
Information Technology. A friend drew my attention to an article in IEEE
Compute called _The Great Term Robbery_ a few years ago; I found both that
article and the standard vocabularies very informative with respect to "What
is data?".

I have never found a succinct list of principles, and if anyone knows of
one, I would love to see it. Codd's 12 Rules embody a lot of principles he
did not name explicitly; although, logical identity, guaranteed access,
physical and logical independence are all principles. Certainly, the
principle of separating concerns applies to data management in several ways.
As a general principle, one prefers to minimize, centralize and automate any
need for highly specialized or arcane knowledge. One prefers to maximize the
portability of one's data. One prefers to make easy things easy and to make
likely errors difficult. One prefers to minimize the learning curve for
casual users. etc.

Of the items in your list above, integrity and data types are fundamental, but your elaborations above are anything but fundamental.

One can come up with any number of taxonomies for integrity
constraints--Chris Date has published enough of them in his career. The
taxonomy I find most enlightening is: All integrity constraints constrain variables. Integrity is fundamental because it is fundamental to the
manipulation function when managing data.

A data type does not enforce business rules--the integrity function of the dbms does this. Data type is fundamental to computing and not only to data management. A data type comprises both a set of values and a set of
operations on those values. With respect to the relational model, Date and Darwen have observed that data types define what we can make statements
about, and relations make statements about them.


Hmmm, I thought Data Types (including UDTs) did enforce business rules, by
constraining the set of possible values that can be stored in a column
constrained to that type.


Data types form part of the definition of some constraints, but the
integrity function of the dbms enforces constraints. What you suggest above
is similar to suggesting that legislation and street signs enforce traffic
laws. Police officers and the judiciary enforce traffic laws.

If a business rule dictates that data of a certain
type must fall within a spefic range, for example, then by defining a type
that imposes this constraint, the business rule could be enforced by the
Data Type?


The type does not impose the constraint; the integrity function of the dbms
imposes the constraint. The type merely describes the constraint. For a very
long time, almost all constraints in commerical SQL dbmses were nothing more
than comments. One was allowed to express them, but the integrity function
of the dbms ignored them (if one can really claim an integrity function even
exists in that situation).
Jul 20 '05 #21

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

Similar topics

4
5972
by: ESPNSTI | last post by:
Hi, Please don't shoot me if the answer is simple, I'm new to .Net and C# :) .. I'm attempting to convert a nullable type to it's "non-nullable" type in a generic way (without knowing what specific type the nullable type is.) The reason I'm trying this is because when I attempt to pass a nullable type value to a SqlCommand parameter and then attempt to execute it I the following error: "No mapping exists from object type...
27
5640
by: Yuriy Solodkyy | last post by:
Hi VS 2005 beta 2 successfully compiles the following: using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program {
5
2055
by: Kevin Yu | last post by:
hi all since the DateTime can't be assign null, the min value is set to 1901 or something, if in a application design, the date field can be null, so in between the UI and the DB, the business logic has to take care of the conversion?? e.g when inserting DateTime.minvalue into db, (especially when using store precedure, it seems that pass null parameter to a store precedure cause problem.), the store procedure must translate the minvalue...
3
2105
by: rubikzube* | last post by:
Hi. I'm trying to write a snippet of code to detect if a variable is a nullable<t> struct, and I can't figure out the right syntax or if such a thing is even possible... Below are the results that I got when I attempted to perform some simple tests. Nullable<int> i = 32; bool isNullableClass = i is Nullable; // false
1
5681
by: Joe Bloggs | last post by:
Hi, Can someone please kindly show me how to determine if a type (read value type) is Nullable. MSDN has this KB: How to: Identify a Nullable Type (C# Programming Guide) http://msdn2.microsoft.com/en-us/library/ms366789.aspx however, using their code snippet, I couldn't get it to work:
5
51682
by: GG | last post by:
I am trying to add a nullable datetime column to a datatable fails. I am getting exception DataSet does not support System.Nullable<>. None of these works dtSearchFromData.Columns.Add( new DataColumn( "StartDate", typeof( DateTime? ) ) ); dtSearchFromData.Columns.Add( new DataColumn( "EndDate", typeof( System.Nullable<DateTime>) ) ); Any ideas?
8
10704
by: Sam Kong | last post by:
Hello, I want to define a generic class which should accept only nullable types or reference types. What's the best way to costrain it? --------- class MyClass<T>{ ...
1
2508
by: lord.zoltar | last post by:
I was asked to make a little "Yes/No" radio button for a project. There was a small wrinkle, that the user might want to have NO button checked. This didn't seem so bad, so I made YesNoValue property for the control and I made it a Nullable(Of Boolean). Now a problem occurrs when I add this control to a form and try to view the form in design view. The warning I get is: "Method 'System.Nullable`1.op_Implicit' not found." When I dive into...
20
2434
by: sarnold | last post by:
Hello, I am proposing to create two new keywords for C, 'notnull' and 'nullable'. Their meaning is a sort of 'design by contract', ensuring some rules are verified at compile-time. It should not require additional runtime- checks to be implemented. I have posted my description of how it should work at this URL:
0
9673
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
9524
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
10217
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
10168
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
10003
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...
1
7546
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
6785
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
5440
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
4114
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

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.