database-design

How to model a custom type in a relational database?

I'm fairly new to database design, but I understand the fundamentals. I'm creating a relational database and I'd like to do something similar to creating a reusable type or class. For example, let's say I have a Customer table and a Item table. Customer and Item are related by a standard 1-to-many relationship, so Item has a column calle...

Database design: columns with duplicate meaning

maybe the title of the question don't describe my problem very well but here it is : let's say i have a table article that look like this: + title + author . . . + status [choices : ('draft', ..., 'translate')] And let's say in my business process i publish in my web page articles that have [status = 'translate'] Is it a good design...

How large to make name fields in database?

There's an old question that asks this very thing, but a lot has changed in databases and unspoken standards. I generally live by the rule as to never make a field size text or memo, even if it speeds up the database. Primarily because someone could flood and possibly hack the db if there are no restrictions in the input interface. ...

Mysql table structure and designing

I have two tables both i am working like below concept... When any record will be inserted 'id' of first table ('id' is unique and auto_increment), I want to use this id value for further insertion in my second table (that means id will be foreign key).How should I should to design my table? If i am inserting values and further fetch...

How should I model a group relation in the database and in OOP?

I have instances of Item that I would like to have in groups ItemGroup. But if an Item is moved to another itemgroup, I would like to keep track of the change for accountability reasons. E.g. I need to know if an Item was in one ItemGroup in October and another in September. How should I model this in the database? How should I model th...

database models for emails

Do someone know where i can get a sample of a database model for emails witch support reply-All, Forwarding, To, CC, CCI... Any link? Thank you ...

How do I model a table tennis match in rails.

I am attempting to model a table tennis match in rails. Here is what I have: Game Model: team_1_score team_2_score team_1_id team_2_id Team Model: game_id player_id Player Model: Name So each game will consist of 2 teams (of either 1 or 2 players each). Then I was planning on linking game to player with has_many, :through. I don'...

How can I create an efficient MySQL database that auto-complete requests like Google

Hi! I'd like to get some ideas on how I can create an efficient MySQL database that can handle high traffic auto-complete requests like Google's new auto-SERP-update feature. The key to this is, I am trying to take the content of my book and I want to index the text in a way such that the database requests the relevant text in the qu...

Single or multiple databases

Hello everybody I am working on service which tracks visitors of websites (website owner just puts some java script to his site... just like Google Analytic or Woopra). There can be websites with low but also heavy traffic (more than 10 000) visits per day. Also count of users of this service can grow to thousands. Database does not hav...

Add ASP.NET Membership tables to my own existing Database OR should i instead configuring a separate asp.net membership database

I was reading through this post here http://www.misfitgeek.com/op-ed/adding-asp-net-membership-to-your-own-database and thought to my self what the common practice is. What do developers using ASP.NET membership and authorization in their applications recommend as a best practice? creating the membership tables in the same database that...

Mysql Connect Two Tables (FK) - Database Design

Hi People, how can I connect the table project_user with the table project_terms in the best way? One Project has different Categorys like 1,2,3,4 The Categorys are stored in the categorys_table But one User maybe are assigned only for the Categorys 1,2 and not 3,4 Should I connect the project_table with the categorys_table too? how ...

Database: when to split into separate tables?

Say if I have two different types of sensors: one monitors analog voltage (such as on a temperature sensor) and one measures whether something is on or off (switch sensor). I can't decide whether to have one table: [Sensor] Id : PK UpperLimit : FLOAT UpperLimitAlertDelay : INT LowerLimit : FLOAT LowerLimitAlertDelay : INT IsAnalog : BO...

Storage and Logical Model in Entity Framework

Could someone clear something up for me? As far as my understanding goes, the physical model describes how the data is represented in the context of a specific storage medium. The logical model is a representation in terms of entities and relationships, independent of any particular data management technology. How do these two work with ...

How to design database with user editable/versionable content using Code First?

I an developing a page where users will be able to add and modify existing content, its not a wiki per sé but sort of, like SO's editing abilities. I am working with EF4 and the new Code First approach in the latest CTP, so what would be the best class design for this? my current guess is something like this: public class VersionableT...

Tools for creating a "test" like environment on a development database

We have an Oracle Enterprise database in production and another instance that we use as both a QA and Development database. QA has requested that they be given separate schemas within the database so they can test applications isolated from changes made by developers. For an example, say the schema used in development and the one that ...

SQL table design help

I've taken over an application that has a SQL backend. There are multiple tables, but the two that I'm concerned about are these: QAProfile --------- ProfileID <pk> -int ProfileName SecurityGroups -varchar(max) SecurityGroups -------------- GroupID <pk> -int GroupName My issue is that the the SecurityGroups field is a comma delimit...

How to validate if there was 12 sequential payments

As example : I have this scenario where we receive payments, a singular payment per family, and register those payments with it's amount in the DB. The thing is that a family can move their loan from bank1 to bank2, only if they have 12 or more sequential payments. As example if they have registered a payment for oct, nov, dec, jan, ...

How to limit the size of a table?

I have a SQL Server 2005 database. I am logging data to a table. I want to prevent the table data from getting too big. How can I limit the size of the table to x number of rows, and keep logging? I want the oldest rows to drop off. ...

RDBMS : Move frequently updated columns into a separate table.

I have a table Users (simplified) : UserId (int, PK) | Username | PasswordHash | LastVisitTimestamp Every time user visits a web site, LastVisitTimestamp column is updated. Is it a good idea to move that column into a separate table, so that timestamp updates do not lock entire row (actual row is bigger than presented here). I did...

How to Model/Document Existing Stored Procedure Flow

Hi, I started working with a GPS Tracking System, whose backend logic is almost entirely based on the execution of Stored Procedures. They were implemented on a SQL 2000 database. I received the task to document/model the existing stored procedure flow, but I don't have experience with such a task. I was used to UML, but since its focu...