Tag Info

New answers tagged

2

You can get rid of the anomaly by changing the FOREIGN KEY constraint (from Widgets to Carts) to include the StorageLocationID: CREATE TABLE Widgets ( widgetID NOT NULL , storageLocationID NOT NULL , cartID NULL , PRIMARY KEY (widgetID) , FOREIGN KEY (storageLocationID) REFERENCES StorageLocations ...


1

Your diagram has a table for Widgets with a StorageLocationID and a CartID. Not sure that makes sense logically, since the StorageLocationID refers to something physical and fixed, and the CartID can move over time. You don't seem to be tracking things over time though, so perhaps that is the disconnect. But when I think of this scenario I think that a ...


2

You could consider a cart to be a storage location. Simply add attributes to the table so that a location can be identified as type "cart" or "shelf", like so: If there's a requirement for a hierarchy - for example, if a cart might be stored in a storage location itself - you could define the hierarchy within your storagelocation table. This is not a ...


1

"Is this realistic to do with something like MongoDB?" If "realistic" means can be engineered to produce acceptable performance then the answer depends on whether you will do with appropriate benchmarking before putting it into production. You can replace "MongoDB" in your question with anything from Access to Oracle and the answer remains basically the ...


3

I think they key phrase is "set". Codd's 1972 paper said "A relation is in first normal form if it has the property that none of its domains has elements which are themselves sets." (quoted from the Wikipedia article on 1NF). In your example, the set is "phone numbers on which we can call this person". Whether you store the phone numbers in a single ...


3

I'm afraid that it's dreadfully easy to do in any SQL/Relational environment: +---------+-------+--------------+--------------+--------------+--------- | last | first | phone1 | phone2 | phone3 | phone... +=========+=======+==============+==============+==============+========= | Smith | John | 303-123-5670 | 303-123-4567 | ...



Top 50 recent answers are included