![]() | |
![]() |
| | Thread Tools | Display Modes |
#41
| |||
| |||
|
|
the more references I have, the better. If you need a collection, you might check these - but if you ask 100 people, you will get 101 oppinions: |
#42
| |||
| |||
|
|
the more references I have, the better. If you need a collection, you might check these - but if you ask 100 people, you will get 101 oppinions: |
#43
| |||
| |||
|
|
the more references I have, the better. If you need a collection, you might check these - but if you ask 100 people, you will get 101 oppinions: |
#44
| ||||
| ||||
|
|
That's not the kind of flags I was talking about; say we need to track expenses and some expense types have an additional field [sic: column] to be required in the form [sic: form? like on the input, non-DB side of the house?]. I might add a column in the expense_types table to indicate whether a datum is required. |
|
The same way, if we write a social network where kids register their quigzmo collection, the "races" table might have a has_tail column -- to avoid asking tail lengths for races that have no tail. |
|
And with a clever trick we might change has_tail in minimum_tail_length, where accepted values are 1 and NULL... I'm not sure I like that |
|
A way to avoid the has_tail flag might be to explicitly state the subset of tailed races... with |
#45
| ||||
| ||||
|
|
That's not the kind of flags I was talking about; say we need to track expenses and some expense types have an additional field [sic: column] to be required in the form [sic: form? like on the input, non-DB side of the house?]. I might add a column in the expense_types table to indicate whether a datum is required. |
|
The same way, if we write a social network where kids register their quigzmo collection, the "races" table might have a has_tail column -- to avoid asking tail lengths for races that have no tail. |
|
And with a clever trick we might change has_tail in minimum_tail_length, where accepted values are 1 and NULL... I'm not sure I like that |
|
A way to avoid the has_tail flag might be to explicitly state the subset of tailed races... with |
#46
| ||||
| ||||
|
|
That's not the kind of flags I was talking about; say we need to track expenses and some expense types have an additional field [sic: column] to be required in the form [sic: form? like on the input, non-DB side of the house?]. I might add a column in the expense_types table to indicate whether a datum is required. |
|
The same way, if we write a social network where kids register their quigzmo collection, the "races" table might have a has_tail column -- to avoid asking tail lengths for races that have no tail. |
|
And with a clever trick we might change has_tail in minimum_tail_length, where accepted values are 1 and NULL... I'm not sure I like that |
|
A way to avoid the has_tail flag might be to explicitly state the subset of tailed races... with |
#47
| ||||||
| ||||||
|
|
That's not the kind of flags I was talking about; say we need to track expenses and some expense types have an additional field [sic: column] to be required in the form [sic: form? like on the input, non-DB side of the house?]. |
|
I might add a column in the expense_types table to indicate whether a datum is required. If you want it to be required, why not use a DEFAULT and a NOT NULL constraint? |
|
The same way, if we write a social network where kids register their quigzmo collection, the "races" table might have a has_tail column -- to avoid asking tail lengths for races that have no tail. What the heck is a "quigzmo"? |
|
The classic scenario calls for a root class with all the common attributes and then specialized sub-classes under it. As an example, let's take the class of Vehicles and find an industry standard identifier (VIN), and add two mutually exclusive sub-classes, Sport utility vehicles and sedans ('SUV', 'SED'). CREATE TABLE Vehicles (vin CHAR(17) NOT NULL PRIMARY KEY, vehicle_type CHAR(3) NOT NULL CHECK(vehicle_type IN ('SUV', 'SED')), UNIQUE (vin, vehicle_type), ..); Notice the overlapping candidate keys. |
|
The idea is to build a chain of identifiers and types in a UNIQUE() constraint that go up the tree when you use a REFERENCES constraint. Obviously, you can do variants of this trick to get different class structures. |
|
If an entity doesn't have to be exclusively one subtype, you play with the root of the class hierarchy: CREATE TABLE Vehicles (vin CHAR(17) NOT NULL, vehicle_type CHAR(3) NOT NULL CHECK(vehicle_type IN ('SUV', 'SED')), PRIMARY KEY (vin, vehicle_type), ..); Now start hiding all this stuff in VIEWs immediately and add an INSTEAD OF trigger to those VIEWs. |

#48
| ||||||
| ||||||
|
|
That's not the kind of flags I was talking about; say we need to track expenses and some expense types have an additional field [sic: column] to be required in the form [sic: form? like on the input, non-DB side of the house?]. |
|
I might add a column in the expense_types table to indicate whether a datum is required. If you want it to be required, why not use a DEFAULT and a NOT NULL constraint? |
|
The same way, if we write a social network where kids register their quigzmo collection, the "races" table might have a has_tail column -- to avoid asking tail lengths for races that have no tail. What the heck is a "quigzmo"? |
|
The classic scenario calls for a root class with all the common attributes and then specialized sub-classes under it. As an example, let's take the class of Vehicles and find an industry standard identifier (VIN), and add two mutually exclusive sub-classes, Sport utility vehicles and sedans ('SUV', 'SED'). CREATE TABLE Vehicles (vin CHAR(17) NOT NULL PRIMARY KEY, vehicle_type CHAR(3) NOT NULL CHECK(vehicle_type IN ('SUV', 'SED')), UNIQUE (vin, vehicle_type), ..); Notice the overlapping candidate keys. |
|
The idea is to build a chain of identifiers and types in a UNIQUE() constraint that go up the tree when you use a REFERENCES constraint. Obviously, you can do variants of this trick to get different class structures. |
|
If an entity doesn't have to be exclusively one subtype, you play with the root of the class hierarchy: CREATE TABLE Vehicles (vin CHAR(17) NOT NULL, vehicle_type CHAR(3) NOT NULL CHECK(vehicle_type IN ('SUV', 'SED')), PRIMARY KEY (vin, vehicle_type), ..); Now start hiding all this stuff in VIEWs immediately and add an INSTEAD OF trigger to those VIEWs. |

#49
| ||||||
| ||||||
|
|
That's not the kind of flags I was talking about; say we need to track expenses and some expense types have an additional field [sic: column] to be required in the form [sic: form? like on the input, non-DB side of the house?]. |
|
I might add a column in the expense_types table to indicate whether a datum is required. If you want it to be required, why not use a DEFAULT and a NOT NULL constraint? |
|
The same way, if we write a social network where kids register their quigzmo collection, the "races" table might have a has_tail column -- to avoid asking tail lengths for races that have no tail. What the heck is a "quigzmo"? |
|
The classic scenario calls for a root class with all the common attributes and then specialized sub-classes under it. As an example, let's take the class of Vehicles and find an industry standard identifier (VIN), and add two mutually exclusive sub-classes, Sport utility vehicles and sedans ('SUV', 'SED'). CREATE TABLE Vehicles (vin CHAR(17) NOT NULL PRIMARY KEY, vehicle_type CHAR(3) NOT NULL CHECK(vehicle_type IN ('SUV', 'SED')), UNIQUE (vin, vehicle_type), ..); Notice the overlapping candidate keys. |
|
The idea is to build a chain of identifiers and types in a UNIQUE() constraint that go up the tree when you use a REFERENCES constraint. Obviously, you can do variants of this trick to get different class structures. |
|
If an entity doesn't have to be exclusively one subtype, you play with the root of the class hierarchy: CREATE TABLE Vehicles (vin CHAR(17) NOT NULL, vehicle_type CHAR(3) NOT NULL CHECK(vehicle_type IN ('SUV', 'SED')), PRIMARY KEY (vin, vehicle_type), ..); Now start hiding all this stuff in VIEWs immediately and add an INSTEAD OF trigger to those VIEWs. |

![]() |
| Thread Tools | |
| Display Modes | |
| |