database-design

POS Database Layout

Our current database layout for store inventory includes a table that houses a record for each item and includes the item attributes such as price, cost, description, SKU, etc. Each store then has a table that has the SKU and the Quantity, and a few other attributes that are different for each store depending on the SKU. Although this ...

Negative integer indexes: are they evil?

I have this database that I'm designing. It needs to contain a couple dozen tables with records that we provide (a bunch of defaults) as well as records that the user can add. In order to keep the user from shooting himself in the foot, it's necessary to keep him from modifying the default records. There are lots of ways to facilitate ...

How to structure database for relational? data

I need to keep track of points scored and who they are scored against. Previously, I did this using a flat file database (that was a mess) that looked like this: 03611100025 00001000000 21011000000 00003000000 00021000000 10001050000 00001402000 00001000100 00001013050 00001000100 00001000000 Each team got a row and a column, and I gu...

When is a good time to break normalization rules?

Please give your opinion of situations in which it is a good idea to NOT normalize. I just witnessed some heated discussions between an architech and DBA who insisted in which one was arguing the database was TOO normalized. ...

Is there a .NET Polymorphic Data Framework

I'm beginning work on a new project that's would be much easier if there was some way to make different data models polymorphic. I'm looking at using the Entity Framework 4.0 (when it's released), but have been unable to determine if it will actually be able to work. Here's the basic scenario. I'm implemented a comment system, and wou...

a question on many-many relationships

I have the following tables items similars items_similars = pivot table items->similars has a many-many relationship the items_similars has the following field item_id similar_id if I am using InnoDB as my engine, do I need to create a relation between items.id and items_similars.id? or between similars.id and items_similars.id?...

how do you enforce conditional not null check across sql columns

create table A (id, col_A, col_B, col_C) id = unique id for every row being persisted either col_A or col_B will have a valid value, but both columns will not have a value for each persisted row at the same time. e.g. insert into A (id, col_A, col_C) values (1, "a", "c") insert into A (id, col_B, col_C) values (1, "b", "c") insert i...

Where should the TClientDataset component be located?

Some background: I want to develop a desktop application, with a SQL database as storage. There is only one user at one time connected to the database. To make maintainance easier, I would like to seperate GUI from Busniss Logic. Thus, I thought using a DataModule (where the BL is implemented), for each Dialog. My question: Where is th...

Poll system multiple answers

If you would want to make a poll system that supports multiple answers (options) (not just yes/no) how would you do it? How would you structure the db etc? I don't want to limit the answers/options. Some input on this would be greatly appreciated. ...

What's the best way to have a "repeating field" in SQL?

I'm trying to set up a table that links two records from a different table. These links themselves need to be correlated to another table. So at the moment, my table looks like this: link_id (primary key) item_id_1 (foreign key) item_id_2 (foreign key) link_type (metadata) However, the links between items are not directional (i...

Storing large amounts of data: DB or File System?

Hello, Let's say my application creates, stores and retrieves a very large amount of entries (tens of millions). Each entry has variable number of different data (for example, some entries have only a few bytes such as ID/title, while some may have megabytes of supplementary data). Basic structure of each entry is same and is in XML for...

Best database design (model) for user tables

I'm developping a web application using google appengine and django, but I think my problem is more general. The users have the possibility to create tables, look: tables are not represented as TABLES in the database. I give you an example: First form: Name of the the table: __________ First column name: __________ Second column na...

Dedicated faceted search engine for dealing with dynamic taxonomies - helps just with performance or also flexibilty?

I've been thinking for a while about modeling typical ecommerce site with ebay-like taxonomy and attributes dependent on a particular product category. First attempt was choosing between EAV and Table Per Class db inheritance modeling. I've chosen the latter because of the performance, but what it meant was creating dedicated table for ...

Advantages to Vertical Partitioning of Table

(Note that this situation isn't exactly how it is, but I made this as an example) I have an entity in a table with data that is updated every 5 seconds (Kinematic Data: Speed, Heading, Lat, Long, and PositionTime), and other data that is updated hardly at all, if ever (Color, Make, OriginTime). Now my boss wants me to partition this ...

What should my directory structure look like for user assets in a web application?

In my web application, each user will have a logo. I am pretty sure each user will also have a photo gallery in the future. What is the best way to set up a directory structure for managing user logos and possibly other assets such as photos? Also would be good to get people's opinions on what to store in the database. My application...

Database tables with only one index ... bad idea?

If a programming language allowed the creation of database tables, but only allowed one field to be used as an index ... how limiting would that be? I am not a real database programmer, so I'm wondering if such a system could be used as the basis for serious databases, or would be only a toy. ...

Separate table or same table?

So I basically have a reviews table, and for ratings I have more than 8 factors. Because my reviews table already has 5 fields, is it better for me to just create an entire new table for ratings or add it on to the reviews table too? Update: I should use the word criteria instead of factor. Ratings 1-5 - Humor, Readability, Customer Se...

How to store dependency tree in a database?

I am trying to store a dependency tree in a PostgreSQL database. There are about 20,000 software items, each item can depend on several other items. There are several types of dependencies (some are run-time dependencies, some are build-time dependencies and some are test-dependencies). The dependency is recursive and each item only kn...

Preferred approach to render number of tags associated with a certain entity?

We have a requirement to tag internal assets (code artifacts ...) which are found within the intranet, so that it can be searched with ease later on. We would like to show the count of assets tagged by a certain tag name (much similar to http://stackoverflow.com/tags). I would like to understand if this count is measured dynamically whe...

Products database design for product lines, categories, manufacturers, related software, product attributes, etc.

I am redeveloping the front end and database for a medium size products database so that it can support categories/subcategories, product lines, manufacturers, supported software and product attributes. Right now there is only a products table. There will be pages for products by line, by category/subcategory, by manufacturer, by suppo...