database-design

Class Table Inheritance vs. Denormalization

I'm trying to model a specialization/generalization, leaning towards using class table inheritance (see this answer). However, my co-worker has maintenance and performance concerns because there will be many (50+) overlapping specializations of the same table. His suggestion is to create a table with the following columns: Reference t...

Best solution for a comment table for multiple content types

I'm currently designing a comments table for a site I'm building. Users will be able to upload images, link videos and add audio files to the profile. Each of these types of content must be commentable. Now I'm wondering what's the best approach to this. My current options are: to have one big comments table and a link tables for eve...

SQL Server denormalization question - store user data in 1,3, or 21 tables?

A section of our web site calls for asking the user 20 multiple-choice questions about themselves (a "profile"). This part of the web site will be frequently viewed, and occasionally updated. The web site is expected to develop a high amount of traffic, so some consideration is being given to try and prepare for performance issues. Th...

Multiple Columns as Primary keys

CREATE TABLE Persons ( P_Id int NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255), Address varchar(255), City varchar(255), CONSTRAINT pk_PersonID PRIMARY KEY (P_Id,LastName) ) The above example is taken from w3schools. From the above example, my understanding is that both P_Id, LastName together represents a Primary Ke...

SO what RDF database do i use for product attribute situation initially i thought about using EAV?

Hi, i have a similar issue as espoused in http://stackoverflow.com/questions/695752/product-table-many-kinds-of-product-each-product-has-many-parameters i am convinced to use RDF now. only because of one of the comments made by Bill Karwin in the answer to the above issue but i already have a database in mysql and the code is in php....

MongoDB RSS Feed Entries, Embed the Entries in the Feed Object?

I am saving a reference to an RSS Feed in MongoDB, each Feed has an ever growing list of Entries. As I'm designing my schema, I'm concerned about this statement from the MongoDB Schema Design - Embed vs. Reference Documentation: If the amount of data to embed is huge (many megabytes), you may read the limit on size of a single o...

How to design logic to store rules assigning badges and reputation points to site users

In my current web application, I have to create a "Reputation Points & Badges Engine" somewhat similar to SO. That system contain many of rules and each rule is associated with few predefined user activities (like view question, vote question, etc). What I am trying to figure out the solution for: 1. Store all rules in database tables (...

Best approach to optimize a record history database

I have a database that keeps record history. For each update to a record, the system will "deactivate" the previous record (along with all it's children), by setting the "Status" column to "0". Now it's not a problem yet...but eventually this system is going to have a lot of records, and history is more important than speed right now. B...

Standard EntryDate/UpdateDate columns in DB, no one uses triggers

Every place I've worked in the past 15 years has had, on almost every table they use, the columns of EntryDate and UpdateDate (or some variant). The developers or DBAs all put in in defaults for those columns of "getdate()" in sql server (I'm sure there is an equivalent in MySQL, Oracle, etc), but they don't ever use an update trigger t...

Managing important runtime business logic with regard to a codebase

I'm working on a project which will end up have a lot of application information stored in the form of records in a database. In this case, it's the configuration of data views: which grid columns to show/hide default filters to apply to each grid view column titles sorting subtotaling ... This information is a big part of the value...

How to structure data... Sequential or Hierarchical?

I'm going through the exercise of building a CMS that will organize a lot of the common documents that my employer generates each time we get a new sales order. Each new sales order gets a 5 digit number (12222,12223,122224, etc...) but internally we have applied a hierarchy to these numbers: + 121XX |--01 |--02 + 122XX |--22 |--23 |--...

Database design question (Book Trading System)

Hello all! I´m developing a Book Trading System... The user will input your Book to trading... I already have a table tblBook with "all" existing books ... So the user will select one book from that list and fill the book´s CONDITIONS and Edition... So, what is a good Database design to tha case? tblBook => All books tblUserBook => ...

The best database table layout/design for a custom ticket system

I'm developing a custom trouble ticket system for network management and trying to find the best database table layout for following scenario: There are tables representing PON, T1 and T3 lines. Each line may have one or more trouble tickets, but every trouble ticket has some unique fields depend on what type of line this tiket belongs....

Revisions: algorithm and data structure

Hi, I need ideas for structuring and processing data with revisions. For example, I have a database of objects (e.g. cars). Each object has a number of properties, which can be arbitrary, so there's no a set schema to describe these objects. These objects are probably saved as key-value pairs. Now I need to change property of an object....

Database design problem: intermediate table between 2 tables may end up with too many results.

I have to design a database to handle forms. Basically, a form needs to go through (exactly) 7 people, one by one. Each person can either agree or decline a form. If one declines, the chain stops and the following people don't even get notified that there is a form. Right now I have thought of those 3 tables: FORM, PERSON, and RESPON...

Database design suggestions for a configurable product eshop

Hello, I am biulding an e-shop that will have configurable products. The configurable parts will need to have different prices and stocks from the main product. What database design would be best in this case? I started with something like this. Features id name Features Options id id_feature value Products id name price P...

Best method to store Enum in Database

What is the best method of storing an Enum in a Database using C# And Visual Studio and MySQL Data Connector. I am going to be creating a new project with over 100 Enums, and majority of them will have to be stored in the database. Creating converters for each one would be a long winded process therefore I'm wondering if visual studio o...

What is the point in using a "real" database modeling tool?

We currently have a 10 year old nasty, spaghetti-code-style SQL Server database that we are soon looking to pretty much re-write from scratch as part of a re-write to a large web application. (The existing application will serve as the functional requirements for the next incarnation of the app). Some have suggested we use Visio to do a...

Entity Relationship Diagram - Relationship Strength?

Hi, I am trying to figure out under what circumstances I should use weak (non-identifying) relationships (where the primary key of the related entity does not contain a primary key component of the parent entity), verses when I should use strong (identifying) relationships (primary key of the related entity contains a primary key compon...

how relate one table to another for future records

I have a games table which holds the data about a game. Then another table which holds the data about news. So far so good. First I thought about creating a junction table for game_news so I could relate news to games. This way works as intended when the game exists. So whenever I insert a news I can relate it to a game using the junc...