database-design

How to model a schedule in Rails?

Using Ruby on Rails 2.3.8, I'm wondering how to represent a schedule for model that handles "reminders". Examples of reminder: "Must do ABC", Remind me in 3 days "Must do DEF", Remind me in 5 weeks "Must do XYZ", Remind me on 2nd Oct 2010 at 5 pm So, the Must do... goes into a description column. But how to deal with the fact that wh...

Data warehouse design forum like meeting site

I finished my meeting site design and now I should create database. But I am not sure which method to use.I am using Apache, PHP and MySQL. I have users, each user has input and output mail box and each user has a friends list. This is the basic scenario. And here I have three questions. For in box and out box should I create a new tab...

Pictures Filenames - GUID or ID-based, When to use which

Hi, I tend to rename a profile user uploaded picture to the corresponding id of that column in the profile table, but recently i saw several projects adding an extra column in the table to identify the related photo (uniqueid, md5 or guid), what is the benefit of doing that, i see it redundant as i can already identify the photo with th...

How should I design the tables to store tags in a database?

"question_id": 58640 "tags": ["polls", "fun", "quotes"] "title": "Great programming quotes" "question_id": 184618 "tags": ["polls", "fun", "comment"] "title": "What is the best comment in source code you have ever encountered?" "question_id": 3734102 "tags": ["c++", "linux", "exit-code"] "title": "Why cant' I return bigger values from ma...

designing a database for cms

hi, what are the first steps for designing a database system for cms? can u please help me with it? i dont know how to start it. what should i do for the begining? ...

how to make foreign key relationship on physically distributed data?

three servers server 1 is central point which links the other two servers. the other two servers have a table which has a field which should act like a foreign key problem well i do not know how to do this, using vs08 or sql server 08 diagram view table on server 1 sv1pg1 id -- primary key details tables same schema on srvr...

Do I really need to have an ID to a child table in rails using active records ?

I have a user model (sql table) that has_one : profile. profiles have user_id to refer to an user object. Do i really need to have profile_id column ? What are the advantages and disadvantages ? I guess one advantage will be the size of the table that will be 1 collumn smaller. What are the disadvantages ? ...

Relational database design question - Surrogate-key or Natural-key?

Which one is the best practice and Why? a) Type Table, Surrogate/Artificial Key Foreign key is from user.type to type.id: b) Type Table, Natural Key Foreign key is from user.type to type.typeName: ...

Do I need to model a dependency explicitly in an ER diagram?

I was looking at ER diagrams today. If we consider two entities, Item and Member in the context of a rental shop, the member can either checkout an item or renew the item. So for this, I came up with the following: The idea was that a member can check out any number of items but an item can be checked out only once. And, a member can ...

Database Design Foreign Keys

Two tables in my database are as follows: [Employee] Table: Id (Primary Key, Autoincrement) FirstName LastName Status [Status] Table: Status (Primary Key) Status is one of the following: "FullTime" "Contractor" "Terminated" How should [Employee].Status reference [Status].Status as foreign key? I see two ways of doing this: [E...

Relational Database Design - double primary key in one table ?

I have a table that keeps the user ratings for items. I want to allow each user to rate an item only once, is there any way to force the database not to allow duplicate for itemId and userId? I don't want each individual field to be a primary key. I want the primary key to be based on both of them at the same time. for example there i...

Need help on database design

Hi all, Let's say I need to store t-shirts and jeans in my products table. They are sharing columns like cost, price, quantity but what about waist(only apply to jeans) and size(only apply to tees). Should I put them all in one table or separate tables? If I put them together, I will have a lot of null values, but if I separate them, wh...

What is the best way to keep changes history to database fields?

For example I have a table which stores details about properties. Which could have owners, value etc. Is there a good design to keep the history of every change to owner and value. I want to do this for many tables. Kind of like an audit of the table. What I thought was keeping a single table with fields table_name, field_name, prev...

database diagram

hi, i want to see a diagram (erd) of a database system which has been designed for cms. would you lpease show me a complete on? tanks ...

Having a class for each table in the database

I'm creating a software for my friends library. For now I have a table in the database for books and movies, but lets say that the user would want to add cds aswell. Then I'd have to let the user create a table in the database for cds. The design so far, is to be having a class for each table in the database, with its fields, and methods...

What type of logic does Netflix use to create customer orders?

I would like to implement something similar, but I'm running into some problems. I would like to know what my options are to approach this problem, and what are the common techniques used in this scenario. (See bottom of this question if you are unfamiliar with Netflix) Current Approach Create a "controls" table that houses information ...

User Access Control and Data Visibility

I have a Access Control based on Roles and Permissions, meaning That each group has permissions to access Some Controllers and users are part of those groups. (this is implemented in CakePHP framework) But this structure allows me to know what user is authorized to "use" like, access reports or add new users, but I was wondering what ar...

How important is database normalization in a very simple database?

I am making a very simple database (mysql) with essentially two types of data, always with a 1 to 1 relationship: Events Sponsor Time (Optional) Location (City, State) Venue (Optional) Details URL Sponsors Name URL Cities will be duplicated often, but is there really much value in having a cities table for such a simple databa...

Open Source hospital or medical insurance related MIS or Hospital Information System in .NET

Hi, I am currently working on a Hospital Information System for the government and I wanted to know if there is a open source (Even a sample or a base not used worldwide) software or even a sample database available to download to get some fresh ideas. If not, is there any information on design and analysis the processes within the hospi...

Two or more similar counts on fact table in dimensional modelling

I have designed a fact table that stores the facts for a specific date dimension and an action type such as create, update or cancelled. The facts can be create and cancelled only once, but update many times. myfact --------------- date_key location_key action_type_key This will allow me to get a count for all the updates done, all t...