Tag Info

Hot answers tagged

5

Instead of creating a separate table for each date, create a single details table and index by product id and effective date: ProductDetails: productId dateEffective price ... This way, you just insert a new row each time the details change. insert into ProductDetails( productId, dateEffective, price ) values ( 1234567, '10/06/2014', 1.25 ...


3

Best choice depends on the specifics of the situation. Your two options resemble two techniques known as "Single Table Inheritance" and "Class Table Inheritance". Click to view Martin Fowler's presentation of these concepts. In SO, questions about inheritance and table design are grouped under two tags of the same name. In SE.DBA, there is a single ...


2

None of the above GoalKeeper, Defender, and Forward are roles, not subclasses/types of Player. A Player may be a Defender in one game, and a GoalKeeper in another. Typically one would have a role-map table to assign players to roles. It is difficult to say precisely what to do without more details, particularly the behavioral and data difference between ...


2

If you have one thing, which has some attributes which cannot change and others which may change over time, you really have two separate things. And that means you should consider giving each "thing" its own table. Neither of your options use the database model to make anyone's job easier. Selecting entirely different tables is an annoying practice, but ...


2

It's possible that the original design kept them separate because the original designer thought that the full user profile would not always be populated for each user. Their original goal might have been to separate a few mandatory fields from a large number of optional and sparsely used fields. They might have done this in an attempt to gain or improve ...


2

As was noted in the comments, it sounds that under third normal form definitions, your proposed fusing of the tables is utterly correct. Fuse 'em.


1

Disclaimer: This is just a personal interpretation based on how I think most people generally use those terms. A conceptual schema is more of a "rough draft", basically just trying to identify the key tables that would be needed, perhaps a few key columns for each, and how they would relate to one another. This might happen in the early analysis phase, or ...


1

A clean design is if you have a startDate and endDate for every price: for a new product: insert into price set product=X, startDate=now(), endDate=infinity for a price change: insert into price set product=X, startDate=now(), endDate=infinity insert trigger fires: update price set endDate=now() where product=X and endDate=infinity This way you can ...


1

All you need is one table, with a simple design. You need A field for the uid Possibly a field for a timestamp (you may need that, you may not, don't know your particular circumstances). A field in which you serialize the Screen object and all the Shapes it contains. That means just one write to save and one read to recover the Screen and its shapes. ...


1

Three points: First, you need to use JOIN to good advantage, so as to retrieve the joined data that you want with one trip to the database, instead of repetitive trips to the database. As James Anderson correctly pointed out, this is what relational databases are all about. However, if you are just learning how to use a database in SQL, then using a ...


1

Sounds like a typical use for a service bus based solution. I solved exactly this problem but for keeping running servers live and interconnected and in sync with each other in my MMO server framework. The simple answer is "don't try and sync the data once its in the database use an event and handle it in multiple locations". It's basically like taking ...


1

Seems to me you may have over normalized this based on the original table design. Unless you are certain that you will need an indeterminate number of factors, you pay a pretty high penalty in insertion and retrieval of data with that schema. Having worked with high data volume sensors (GPS readings) I found that performance considerations pay a heavy role ...



Only top voted, non community-wiki answers of a minimum length are eligible