schema-design

How would I calculate timespans from a list of check in and check outs?

I'm writing a simple time tracking program to manage my own projects. I'm a big fan of keeping reporting code in the database, so I've been attempting to create a few sprocs that generate the invoices and timesheets etc. I have a table that contains Clock Actions, IE "Punch In", and "Punch Out". It also contains the user that did this a...

Best schema design for table relationship that enforces integrity

Given a table of models 'A', that can have multiple child models 'B', of which 'B' will have one or more child models 'C'.. this sounds simple, however I need to enforce that for each 'A', any 'B' must have a unique collection of 'C'.. for example, C cannot be a child of two 'B's that are part of the same parent 'A'.. but a 'C' can be a ...

Database design one to many where many is at least one

Somewhat related to my previous question, this is regarding creation patterns to enforce table patterns where 'A' has many 'B' children where 'C' is the table of child 'B's for 'A', but has at least ONE. Currently I have: A (A_ID primary key, B_ID reference key) B (B_ID primary key, etc) C (A_ID reference, B_ID reference) The point i...

XML element unique id Schema repersentation

My XML looks likes this : <company> <employee id="1">Larsen</employee> <employee id="2">Smith</employee> <employee id="3">Sam</employee> </company> How to write a xml schema so that employee element is defined such a way that each employee has a unique id attribute (no two employee elements can have same value for id attribute) ...

Best way to design database tables with interbase?

I am about to start redoing a company database in a proper fashion. Our current database is a mess and has little to no documentation. I was wondering what people recommend to use when designing an Interbase database? Is there some sort of good visual schema designer that will generate the SQL? Is it better to do it all by hand? Basica...

help needed with hbase schema design

Hi, I am trying to design a high scale key value storage system. The hbase schema for the same is outlined below: { "userid1" : { "update" : { t3 : "some update1", t2 : "some update2", t1 : "some update3" }, "sender" : { t3 : "sender3" t2 : "sender2" t1 : "sender1" }, "...

Database design question

I am designing a simple database of online exam system. But i can not figure out how the questions and the answers should be stored. I am thinking question and Answer as different entities. There will be both MCQ and short questions in the same question set and the number of questions in a set may be dynamic(choose by teacher). Please s...

The Ruby community values simplicity...what's your argument for simplifying a db schema in a new project?

I'm working on a project with developers who have not worked with Ruby OR Rails before. They have created a schema that is too complicated, in my opinion. The schema has 117 tables, and obtaining the simplest piece of information would require traversing/joining 7 tabels...and of course, there's no "main" table that serves as a sort of...

Suggestions on how to organize Core Data visual layout?

Core Data is pretty amazing, and I've really enjoyed using the visual layout Xcode provides for it to organize things and get a quick sample of what data I've placed where. At times I've started to wonder if I'm making the best use of it, however, as after a while there tends to be such a mass of arrows that it becomes difficult to tell...

Maintaining Consistency Between JavaScript and C# Object Models

I'm working on an ASP.NET web application that uses a lot of JavaScript on the client side to allow the user to do things like drag-drop reordering of lists, looking up items to add to the list (like the suggestions in the Google search bar), deleting items from the list, etc. I have a JavaScript "class" that I use to store each of the ...

DB schema design in Django

I am in the process of creating a database to hold quality inspection records and learning Django at the same time. I may have jumped into creating models too soon as I've run into conceptual problems of how I'm defining the classes. The goal is to have a "master" inspection plan that defines what is to be inspected and an "instance" ins...

SOLR schema design question: field absence or boolean field?

I need to partition my SOLR index into two halves. As it turns out I already have a STRING field which represents the partitioning info I need. Meaning, one kind of record that would be searched for is where the string field is present in the record and contains a value, the other kind is where it contains no value. All queries must s...

When is referential integrity not appropriate?

I understand the need to have referential integrity for limiting specific values on entry or possibly preventing them from removal upon a request of deletion. However, I am unclear as to a valid use case which would exclude this mechanism from always being used. I guess this would fall into several sub-questions: When is referential i...

Monthly Reports in Django - Enforce uniqueness for month?

heya, This is a fairly quick question regarding schema design for a Django project. Basically, we have a series of monthly reports from different departments that are aggregated into a single report with some pretty charts (we're probably going to use Google Visualization API for that, but I'm open to other suggestions, if you think so...

Inheritance in XML Schema definition (XSD) for Java objects

Hi, I need to create an XML schema definition (XSD) that describes Java objects. I was wondering how to do this when the objects in question inherit from a common base class with a type parameter. public abstract class Rule<T> { ... } public abstract class TimeRule extends Rule<XTime> { ... } public abstract class LocationRule exten...

Oracle Schema Design: Seperate Schema with I/O Overhead?

We are designing database schema for a new system based on Oracle 11gR1. We have identified a main schema which would have close to 100 tables, these will be accessed from the front end Java application. We have a requirement to audit the values which got changed in close to 50 tables, this has to be done every row. Which means, it is...

In SQL / MySQL, are there reasons not to put one-to-one relationship in the same table?

One-to-one relationship could usually be stored in the same table. Are there reasons not to store them in the same table? ...

Schema design: many to many plus additional one to many

Hi, I have this scenario and I'm not sure exactly how it should be modeled in the database. The objects I'm trying to model are: teams, players, the team-player membership, and a list of fees due for each player on a given team. So, the fees depend on both the team and the player. So, my current approach is the following: **teams** ...

MongoDB Schema Design - Real-time Chat

I'm starting a project which I think will be particularly suited to MongoDB due to the speed and scalability it affords. The module I'm currently interested in is to do with real-time chat. If I was to do this in a traditional RDBMS I'd split it out into: Channel (A channel has many users) User (A user has one channel but many messag...

Can a binary tree or tree be always represented in a Database as 1 table and self-referencing?

I didn't feel this rule before, but it seems that a binary tree or any tree (each node can have many children but children cannot point back to any parent), then this data structure can be represented as 1 table in a database, with each row having an ID for itself and a parentID that points back to the parent node. That is in fact the...