database-design

How to best implement a 1:1 relationship in a RDBMS?

Yesterday while working on a project I came up on a peculiar 1:1 relationship which left me wondering - how to best implement this (clearly, we had done it wrong :D) The idea is that there are two types of entities, A and B. They can each exist on their own just fine, but they can also have a link between them. If there is a link, then ...

mySQL - Should I denormalise?

Overview (Sorry its vague - I think if I went into more detail it would just over complicate things) I have three tables, table one contains an id, table two contains its own id and table one's id and table three contains its own id and table two's id. I have spent a lot of time pondering and I think it would be more efficient for tabl...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns and there will be about 10 child entities inheriting from the parent. Each child entity will have about 10 columns. I thought it made sense ...

Database Design w/ Foreign Keys Question

I'm trying to use foreign keys properly to maintain data integrity. I'm not really a database guy so I'm wondering if there is some general design principle I don't know about. Here's an example of what I'm trying to do: Say you want to build a database of vehicles with Type (car, truck, etc.), Make, and Model. A user has to input at le...

When should transient properties in CoreData be included in the object model?

I am unsure about the correct definition of transient properties: One can define transient properties in the object model and then calculate them when needed in the related class. But things work just as well if you specify a class and define arbitrary getter methods for any transient property without declaring it in the object model (...

OSS BSS Database separation

Service provider frameworks generally there have two systems viz. OSS(Operational Support System) and BSS (Business Support System). Theses systems are separated by deployment constraint, in most of the cases one has one bss deployed per 'n' number of oss sites. While designing any such framework is it advisable to have database separat...

Automatic Wordpress installation?

I've been wondering about making a blog hosting site like blogspot as a bit of a hobby. I figure Wordpress would be ideal to use but I'm not 100% on a lot of things related to this. Can I simply create mysql databases and wordpress installs with php functions and keep it secure from possible hacks? Or would the server as a whole need its...

database design suggestion needed

I need to design a table for daily sales of pharmaceutical products. There are hundreds of types of products available {Name, code}. Thousands of sales-persons are employed to sell those products{name, code}. They collect products from different depots{name, code}. They work in different Areas -> Zones -> Markets -> Outlets, etc. {Al...

What is the best approach to writing a stored procedure for a 1:N relationship performing an insert?

If I have two tables A and B: A(AId, a1, a2) B(BId, AId, b1, b2, b3) On first thought , I wanted to write a sp (stored procedure) incorporates the two insert statements. But, on a second I thought I felt it would be nicer if I had a separated sp to do an insert for the table B and another to do an insert for table A while calling the ...

How to implement multi-level hierarchies in user management

Implement multi-level hierarchies so that super user have also all rights that sub user have means super user can also manage sub-users jobs. How design the database for this. ...

How to turn a single-site app into a mantainable multi-site app without code changes?

It's an application that we use internally at the office that I would like to offer as a hosted service for anyone. How can I do that without making major code changes? The first thing that occurs to me is to have the app select which database to connect to based on the domain. So each instance of the app would have its own databas...

Multitenant DB: Why put a TenantID column in every table?

Every tutorial I've seen about Multitenant database models tells you to put the TenantID in every single table: zoos ------- id zoo_name tenant_id animals ------- id zoo_id animal_name tenant_id However, this seems redundant to me. Why not add the tenant_id column to just the zoos table and exploit the foreign key relationship betwee...

Are there object-oriented databases with fulltext search out of the box?

My task ahead is to insert a giant amount of data into a document-oriented DB (any one of them) and have it be full-text searchable as a whole (on all or any field). Do I have to use a DB and a separate full-text search index like Solr or are there document-oriented DBs with fulltext search kind of built-in? ...

"Photo field" in "article_table" or independent table for photo?

Hi all; I have a table for articles with several fields ,each article can have photo/photos ,is it good that have a field for photo in article_table or i make another table for photo/photos and why? thanks ...

App engine many-to-many data modelling

I have a question regarding how to model a many-to-many relationship in App Engine: A Blogentry can have many tags, a tag can apply to many blog entries. I see a couple of scenarios: Use a Set of Strings as an attribute on the blog entry. This allows me to easily query for an entry using a tag This does not allow me to fetch all ta...

Help determining Maintenance Item table structure best practice

I have two different existing Database design's in the legacy apps I inherited. On one side they created two tables; tblAdminMaintCategory and tblAdminMaintItems. On the other side individual tables for everything; tblAdminPersonTitle and tblAdminRace. Method #1 Now in the first example there would be an entry in tblAdminMaintCategor...

Your ideas for this magazine-database that i have design ?

Hi all; It is my appreciate that writ your suggestion about this db that i have design for a magazine online: -one article can belong to many categories. -one article can have null or many photos. -one article can have null or many tags. Table: `tb_categories` Columns: `cat_id` (Primary Key) `catname` `parent_id` . Table: `tb_art...

Whats the best breakdown of order status types for shopping cart 'Order' TABLE ?

I've seen several different shopping cart schemas with different tables for order status type / shipping status type / payment status type. I want to get this right first time for my project and wondered what the best approach is, and hopefully someone with sample tables for me to use. The key thing, of course is that however many colu...

What's the best way to create a 'history' type model in django?

I'd like to create a feature for my Django app similar to Django admin's 'Recent Actions', in order to store history information on my other models. For example say I have two models called Book and Author. I want to have a third model that stores information such as what action was performed on a given object in a model (add, modify, d...

How should I construct a finance DSL?

I've decided to build a database tracking the credit card offers I get in the mail, and one confounding factor has been how to represent the offers. With minimum finance charges and variable rates and mimimum variable rates it gets a bit more complex than "10.99 percent". I've decided I need to construct a language to represent these thi...