database-design

Database design problem (or question)

Hello. I'm designing a database with three tables: user, game and (probably) register. I want to represent that a user can be registered on zero or more games. I use table register to register a user in a game. I also need to store the score of the user in a game. My question is: Can I add a column called score in table register? Is...

Is there a benefit to creating a very generic data model for a Rails 3 Project?

A Product can have lots of things said about it, I'll call them Properties. It can have a brief description. But that description can be in multiple languages. Likewise, it can have multiple Prices, some which are specific to Customers. Given the following data: Product: identifier: 123-ABC Price: value: $1.25 currency: ...

MySql - Large Single Table or Multiple Small Tables

I am in the process of building a PHP/MySql database application which could have heavy usage on certain tables. Three tables have the potential to have lots of UPDATEs executed - here is some information about these tables each user will have a maximum of 200 rows per table each row can be as large as 250k potential user base may be...

Database design pattern for inheritance / overrides

I am looking for a good way to implement - default characteristics for an object and override the defaults in a database. I have a table called Products - that maintains the list of products One of the products is mailbox and the value for the attribute color is blue I need the ability to specify that mailbox is red when the country is...

Foreign Keys in Log Table

Hey, so a bit of a design question here: I am working on a project that requires me to keep track of when a user performs an Insert, Update, or Delete. The thing I am trying to decide on is whether to have the Logs table reference the Primary Key of the affected row or some other identifier. In order to log a deletion when using Forei...

Rails Users has_one :profile vs. show page

Hello, I have a best practice/efficiency/performance issue. If I want to have a profile page for each user in my system and i already have a user model. Is it better to have all the users information in the user model and pull it on the show page of users so users/show will access the user model and grab all the relevant data like a...

Challenging data modeling scenario

I have to create a model that stores gameplay controls for games on several platforms. I am having trouble finding the right approach. Controller buttons are different on different systems (Wii, Xbox 360, PS3 have their own specific controller buttons.) Some games are actually several games packaged as one; this means a single product ...

database design

I have a parent class and 2 sublasses of it.Now, I need to know if the set of instances of both the subclasses are equal or not? I am doing CIOM design In database. ...

Google Map & search by location feature

I'm building a site where my users will be able to specify locations (say, their residence, etc.). Then, I want to do 2 things to this information: Plot these location on a mapping service (such as Google Map) Allow users to search by location (e.g. find all users that live in or are in a certain radius from XYZ city) The question I ...

Why n in varchar(n) is to be specified as concrete digit?

I did red-read on this and could not clearly understand... Having (for the purpose of shortening this question) DECLARE @temp VARCHAR(4001); --update: 4001 is for example only to avoid varchar(MAX) discussions -- I am aware about 8000 SET @temp = 'a'; does SQL Server reserve 4001 bytes for @temp which (the rest 4000 from 40...

Multiple databases or table naming conventions?

How do you split up your data for an application based on a database? A lot of software will have tables named something like Auth_Users, Auth_Whatever, Auth_Something, and then Admin_Something, Admin_Whatever, etc. Essentially the tables all exist in one database but they are organized by a naming convention. The other option would be t...

How can I use active record to link two tables with different "types"

I'm trying to create a database with two models a user and a an mp3 file. I want the user to have two relations on the mp3. The following are the use cases I want to tackle. User has created many mp3's many mp3's have been created by a user User own many mp3's (He could have bought and mp3 from a store) many mp3's have been bought by ...

Storing graphs in fully-normalized relational databases

I've nearly killed myself, multiple times, trying to find the perfect, flexible schema for storing many different types of objects with a wide variety of links between them in a relational database. But models such as EAV and things like polymorphic relationships just aren't true to relational databases. After learning about NoSQL graph...

Can you use a key-value store as the primary database for your application?

I am developing an application that will be deployed to Amazon EC2. I've had a good look at membase, which is a key-value store that can scale out very easily. However, I'm not sure that you can use that as your primary (or at least, only) datastore. Ie, you will need something else that will be able to hold search-able/query-able data. ...

Is a master table with only one column necessary in this mysql example?

I have a mysql DB with a table that holds version information for multiple other tables. In order to link to the same family of versions I have a version_master table that holds a primary key to the family of versions that the link refers to. I was wondering if there was a more elegant solution without the need for a version_master table...

SQL Server 2000 vs. 2005+ sample databases to study db design?

I always tried to learn using the most recent versions of SQL Server, books, articles, docs. I started to doubt whether it is efficient. I've got a feeling that I am frequently inefficiently loosing time with learning materials based on bloated AdventureWorksXXX sample databases from SQL Server 2005+. Even simplest principles and conc...

Password hashing - how to upgrade?

There's plenty of discussion on the best algorithm - but what if you're already in production? How do you upgrade without having to reset on the user? EDIT/DISCLAIMER: Although I originally wanted a "quick fix" solution and chose orip's response, I must concede that if security in your application is important enough to be even bothe...

What are some useful online database modeling applications?

I realize there have been prior questions regarding database modeling programs, but in particular I'm looking for online ones. Can anyone recommend any? And FYI, I will be using PostgreSQL but any generic one should suffice. ...

EER design and CIOM design

Does any body know about CIOM and ER design in database? I have few queries in it and want help. Plz reply back to me with your email id so that I can send you the design there. Please...I need your help.. ...

Is there a reason for a Primary Key column that would never be used?

I have a routine that will be creating individual tables (Sql Server 2008) to store the results of reports generated by my application (Asp.net 3.5). Each report will need its own table, as the columns for the table would vary based on the report settings. A table will contain somewhere between 10-5,000 rows, rarely more than 10,000. Th...