database-design

Dilemma regarding database design for a discussion board using MySQL

In a discussion board there are generally many more posts, than topic headlines (titles). IMO it would be a cleaner practice to treat headlines as posts, but wouldn't it put serious penalty on performance if MySQL searches through every post to catch the headlines? Making a seperate table for the headlines would certainly increase the p...

MySQL design question - which is better, long tables or multiple databases?

So I have an interesting problem that's been the fruit of lots of good discussion in my group at work. We have some scientific software producing SQLlite files, and this software is basically a black box. We don't control its table designs, formats, etc. It's entirely conceivable that this black box's output could change, and our design...

What is a unit of work in regards to database objects?

In layman's terms, what is a unit of work in regards to database objects? I'm researching how to convert database tables into C# classes and I frequently come across this term, but everyone seems to describe it as if you should already know what it is. ...

track sales for week/month and find the best sellers

Lets say I have a website that sells widgets. I would like to do something similar to a tag cloud tracking best sellers. However, due to constantly aquiring and selling new widgets, I would like the sales to decay on a weekly time scale. I'm having problems puzzling out how store and manipulate this data and have it decay properly over ...

Database design for general web form

I want to build a back end of a general web form which contains questions which the user can answer. There are multiple types of questions. "Normal" text question: the question is answered via a simple text field. Example: General personal info, like the name. Textarea question: the same, but with more space to write the answer. Exampl...

Want to create a facebook likenews and updates ...

Hi guys, I'm wokring on a simple social network site and I would like to build a simple news update feed. Feed not in the actual sense but you know like those little reports you get on facebook eg when someone posts a picture you get a simple report saying in your main page that - so and so added a picture, or so and so added a comment. ...

Ecommerce diferent cart items DB & models design

Hello, I have a ecommerce site that has 2 types of products: books & seminars participations. They are different, and have different attributes. I am curious how would you model this in the DB and as models (since you cannot inherit multiple classes) Right now i have something like: DB products (id, name ....) seminars (id, title, da...

Database modelling or database design: Which comes first?

I would like to know which is the common practice for a domain implementation. Designing the business objects first, that need persistence or the database schema first, generating it from an entity relationship diagram (and afterwards the ORM poco*'s)? I am going to start a solution, but I would like to know which is the most preferabl...

Preserve historical data.

I am writing a standard database-backed business application. Assume that I work with bank accounts as well as "Decisions". A decision is a choice the user takes of moving money from one account to another. Each decision is taken at a particular date. A decision can have one or more "source accounts", and each "source account" will have ...

OO behaviour for an ER database (One-to-many relationship for multiple tables)

I'm designing a document management system for a school (SQL & .NET). The school has various data it would like to store, such as personnel, pupils, financials etc. The system should be able to attach a document to any of the records in the system irrespective of its type (personnel, pupil...) A typical ER way of doing this would be to ...

Single column of strings or two columns ?

I am saving a single string to a table, it must be unique i will check that it doesnt already exist before saving it. THere are no other fields. can I just have a single column table with the string as the primary key or should I have a uniques identifier ID column as well? Why in either case? ...

Updating multiple tables with LinqToSql in one unit of work

Table 1: int ID-a(pk) Table 2: int ID-a(pk), int ID-b(pk) Table 3: int ID-b(pk), string C I have the data to insert into Table 1. But I do not have the ID-a, which is autogenerated. I have many string C to insert in Table 3. I am trying to insert row into Table 1, get the ID-a to insert in Table 2 along with the ID-b that is auto-Ge...

Storing diverse value types in a database

I need to store key-value pairs in a database, where key is either e.g. a string, and value can be one of multiple types (integer, string, float/date, GUID, BLOB). The Database is accessed through OLE DB, so I want need to stick to "normal" types. They keys might be involved in "exists" queries, values are not involved in queries (i.e. ...

Implementing a database application for multilevel marketing

I'm doing a project in the field of multilevel marketing on .Net and SQL server. In the database it should save like a b-tree. How should i design a database? ...

Database design problem

I have a problem creating a database schema for the following scenario: (I’m not creating a dating site but just using this as an example) A user logs on to a dating site and is given a multiple selection for the hair colour they’d like their date to have: This is easy enough to model with the three tables below: Tables: User {key}...

mysql too many columns?

I'm creating a table with 30-50 columns. There are about 200K of these rows. Is it recommended to store this data in separate tables? Are there performance issues when you have this many columns. I'll explain a bit about the table. I have to store all sports games over the past 10 years (basketball, baseball, football, hockey). Fo...

Single tenant, multiple application database design?

Most questions about tenancy are centered around multi-tenancy database design issues. I want to know about single tenancy but multiple applications. The software I'm developing allows for a single user to create, from a single code base, multiple applications(I call them "sections"): user could create a blog inside domain.com/applicat...

Database design question: How to handle a huge amount of data in Oracle?

I have over 1.500.000 data entries and it's going to increase gradually over time. This huge amount of data would come from 150 regions. Now should I create 150 tables to manage this increasing huge data? Will this be efficient? I need fast operation. ASP.NET and Oracle will be used. ...

Drawing autogenerated values from same sequence on two tables

Hello all, I have two distinct sets of users in a database. I want to track whether each user has taken a survey. The two sets of users have no common attributes whatsoever. (That is, one set of users have an arbitrary id number, name, and sometimes email address. The other set have an arbitrary id number and email address. The only com...

In symfony/doctrine's schema.yml, where should I put onDelete: CASCADE for a many-to-many relationship?

I have a many-to-many relationship defined in my Symfony (using doctrine) project between Orders and Upgrades (an Order can be associated with zero or more Upgrades, and an Upgrade can apply to zero or more Orders). # schema.yml Order: columns: order_id: {...} relations: Upgrades: class: Upgrade local: order_id ...