data-modeling

Data modeling of interdependent hierarchies

I'm trying to make a sales report based on the following: DColor IdColor ColorPalette ColorName 21 Vibrant Blue 22 Nature Brown 23 Vibrant Red 24 Nature Black 25 Vibrant Yellow ... ... ... DFurniture IdFurniture FurnitureType FurnitureName 43 ...

How to count both sides of many-to-many relationship in Google App Engine

Consider a GAE (python) app that lets users comment on songs. The expected number of users is 1,000,000+. The expected number of songs is 5,000. The app must be able to: Give the number of songs a user has commented on Give the number of users who have commented on a song Counter management must be transactional so that they alway...

Data model refactoring for Rails-based fundraising event registration/pledging site

I'm re-factoring a semi-successful Rails-based event registration and pledging system for a particular fundraising event for a non-profit. The existing data structure is rather ungainly, though it captures all necessary details and relationships. I would plan to refactor this in any case, but since I've also been asked to allow for mul...

How to model cascading settings in an object hierarchy

Trying to put my head around how to model the notion of default values in an object hierarchy. These default values should apply to all objects in the hierarchy unless an object overrides a setting. If a setting is overridden, then it and all of its children would get the overridden value, but other values would be pulled from up the h...

Modeling an organizations hierarchy then been able to map details of each different organization in Nhibernate

We are trying to model a school system hierarchy from State>County>District>School, hence we are using the model below to describe the parent child relationship along with organization type (i.e. School, District,…). Organization Hierarchy Now we need to store details on each particular organization, for example if it’s a school we n...

Succinctly storing atomic model data for OpenGL program

I want to be able to store an atomic model in an OpenGL program I'm writing. Nothing fancy; just constant mesh vertex values stored as GLfloat[3], plus simple textures. I also want the model to be able to move and rotate freely and as a single object. Here's what I have so far: typedef struct _coordnode { GLfloat *pts; /* ...

How to generate MySQL Workbench Detailed Model Report?

Hi, I am using the 5.2.15 OSS Beta version of MySQL Workbench. I have seen somewhere MySQL Workbench Detailed Model Reports (nice HTML version of the entire Model, gives details of the schema). I don't however see any link in the workbench that can generate such a report. Is there a plugin for this or is this feature no more available n...

How to enforce uniques across multiple tables

I have the following tables in MySQL server: Companies: - UID (unique) - NAME - other relevant data Offices: - UID (unique) - CompanyID - ExternalID - other data Employees: - UID (unique) - OfficeID - ExternalID - other data In each one of them the UID is unique identifier, created by the database. There are foreign keys to ensure ...

Database design - Approach for storing points for users

Just looking for some suggestions on how to approach the database design for this. On my site a user can get points for performing different activities. Currently there are 3 activities for which I award points - but the design has to be scalable where I can add other activities for awarding points as well. So today - the user gets poi...

Are there any data modeling exercises for Cassandra like Retwis for Redis?

I'm trying to learn how to map the entities/actors/objects/things in my application for storage in Cassandra. There was a great tutorial for Redis on modeling Twitter data and typical access patterns called Retwis [1]. I've found a couple of examples for Cassandra. How did you start to gain an intuition for Cassandra's data model? [...

Appengine convert a field of type "String" to "Text" after saving serveral items?

So Here is the problem, I've created an entity with a field of type "String" made several of those items and now realise I need more room and therefore need to convert that field to "Text". I tried the null trick but that isn't one of the options. Any ideas? ...

SQL database Structure

I've got a list of synonyms and need to create a database in SQL for it. I was thinking about using a Relational Database Design, but don't know if it would be the best. There will be a decent amount of traffic using this database. I was thinking about Table1 would be like Id Table2 Id InterlinkID (Table1 Id) Word Would this be th...

Mysql: enum confusion

I have an employee table, employee has interests, so the table can be designed like this: create table emp( id int(10) not null auto_increment, name varchar(30), interest varchar(50), primary key(id) ); or this: create table emp( id int(10) not null auto_increment, name varchar(30), interest enum('football','basketball','music...

Eliminating redundant relationships when modeling Header/Detail relationships?

I've got a model that looks something like this: One Account has many Branches, and each Statement is generated for one Account. The model is redundant because the Account (the AccountID on the header) can be inferred from the BranchID on a transaction (a statement will always have one or more transactions). Should the AccountID b...

Conceptual data modeling: Is RDF the right tool? Other solutions?

I'm planning a system that combines various data sources and lets users do simple queries on these. A part of the system needs to act as an abstraction layer that knows all connected data sources: the user shouldn't [need to] know about the underlying data "providers". A data provider could be anything: a relational DBMS, a bug tracking...

How do news sites prevent duplicate articles from showing up on homepage?

News sites usually have a featured section and some category based news. The featured articles belong to a category but when they're featured they don't show up in the category section - what's the common way of doing this? Should I save a list of all the articles that are featured, then grab the latest news from each category, except pr...

SQL Server primary key on datetime field

I'm creating a new table in SQL Server 2005 that needs 2 fields: DateTime and MyValue (Int32). The DateTime field will be unique so I will be setting a unique constraint on it. Which table structure is better and why? MyIndex (PK, int) MyDate (datetime) (IX_UniqueKey) MyValue (int) or MyDate (PK, datetime) MyValue (int) My feeling i...

Star-schema: Separate dimensions for clients and non-clients or shared dimension for attendants?

I'm new to modeling star schemas, fresh from reading the Data Warehouse Toolkit. I have a business process that has clients and non-clients calling into conference calls with some of our employees. My fact table, call it "Audience", will contain a measure of how long an attending person was connected to the call, and the cost of this ...

Simple SQL Data Modeling question

Given that I have a table that holds vehicle information and one of those pieces of information is VehicleType (usually 6-20 characters), what are the technical reasons why it is better to design the tables like this: Vehicles VehicleID VehicleTypeID (INT) (relates to an INT in the VehicleTypes table) versus this: Vehicles Veh...

Core-Data: How to Delete Entities in a Relationship

Hi everyone, I have a complex Core Data graph on the iPhone. A user entity has a lot of other entities which are related one to the other with multiple relationships etc... My question is how can I delete all the related entities when I delete the user entity. Thanks in advance! ...