database-design

TSQL and ADO - I get interview questions on TSQL, but none on ADO, is this normal?

I've been to on a few interviews for middle tier roles. I've gotten a lot of questions about TSQL, indexing, database fundamentals, but not a single question on ADO. Is this a normal experience or is there a reason for this? ...

Version changes for Stored Procedures

I have an application that relies very heavily on stored procedures (SQL 2005/2008). We are doing a minor update that will modify 25-35 of these stored procedures. The application is such that both versions of the stored procedure must be available. This is major version 4 of the application and usually we've been able to completely m...

Store data series in file or database if I want to do row level math operations?

I'm developing an app that handle sets of financial series data (input as csv or open document), one set could be say 10's x 1000's up to double precision numbers (Simplifying, but thats what matters). I plan to do operations on that data (eg. sum, difference, averages etc.) as well including generation of say another column based on co...

Where can I find SQL statements to create EAV model?

Alternatively, anyone know of where I can get the EAV model for Erwin? ...

Storing parametrized definitions of sets of elements and single pass queries to fetch them in SQL

Suppose a database table containing properties of some elements: Table Element (let's say 1 000 000 rows): ElementId Property_1 Property_2 Property_3 ------- ---------- ---------- ---------- 1 abc 1 1 2 bcd 1 2 3 def 2 ...

relationships in Sql

I know how to create one to many, many to many relationships in SQL Server, but is it possible to create one to one relationship? And is it possible to create 1 to 0 or 1 relationship? ...

How should I handle entries when the user is deleted?

I run a forum which I built myself. Ok so all users have the opportunity to delete themselves. But all their threads and posts will remain. But right now where it should say their username it's just blank. How should I handle this? Should I make a new user and call it e.g. "deleted user" and assign all threads/posts to that ID when t...

DB design for multiple types of entities

I need to develop an application where there will be 4 types of user entities (administrators, partners, companies and clients), each user type has it's own set of details and they all should be able to do common operations like send messages, make payments and so on. These operations should be kept on a single table but they need to ref...

Composite primary key question in MySQL

I am a newbie to databases. I am using MySQL, and I have a table A using three attributes to form a composite primary key: A: [key1, key2, key3], dateCreated, createdBy, ... Now I have another table B, which needs to refer to records from the table above. Now, reusing all the three attributes above again to form a key seems to be a pai...

Personal Messaging System in Database

Hello, I am new to databases, and would like to know how to best store personal messages in a database (with SQLAlchemy). Because I wasn't sure, I have tried the following table for PMs pm_table = Table('personal_message', metadata, Column('id', Integer, primary_key=True, autoincrement=True), Column('from_id', Integer, Forei...

Why not always use GUIDs instead of Integer IDs?

What are the disadvantages of using GUIDs? Why not always use them by default? ...

Correct normalization of database with optional columns

I need to create a database table that stores parametric descriptions of physiological characteristics (e.g. systolic blood pressure, triglyceride concentrations, etc.) of a hypothetical cohort of patients. For example, supposing the user specifies a triangular distribution for SBP, then the minimum, maximum and mode (and distribution t...

How to handle a few dozen flags in a database

Like most apps, mine has a "users" table that describes the entities that can log in to it. It has info like their alias, their email address, their salted password hashes, and all the usual candidates. However, as my app has grown, I've needed more and more special case "flags" that I've generally just stuck in the users table. Stuff...

Need to create messaging system like in facebook - any ideas for database design

Hi guys, I'm building a small messaging system like you have in facebook. Only thing is that I want to know whats the best way to get on about it. The database design to be precise in this case. Like all users would have an inbox and sent items folder. Logically something in one persons sent folder would actually be in someone elses inb...

how "most visited" works in applications

In the home page of my app, I try to implement something like "most visited websites" that Chrome & Safari have in their home pages. The major diff being that instead of websites the app will show Objects from the DB (Persons,Organizations,Orders, Invoices etc). It should work like automatic bookmarking. There is already a "Recently Vi...

How do I normalise this database design?

I am creating a rowing reporting and statistics system for a client where I have a structure at the moment similar to the following: ----------------------------------------------------------------------------- | ID | Team | Coaches | Rowers | Event | Position | Time | -------------------------------------------------...

Programming first, framework second?

Firstly hello as my first question. Looking for guidance rather than coding fix. The final flicker of Informix 4gl contracting extingiushed for me in 2004. To cut a long story short I am looking to code again by creating a website. I will be using PHP v5 and MySQL. Spent about a year (in spare time) doing all data analysis and DB desig...

Where we can find database designs schemes (ERD or other) for very common use cases?

The question is more simple than what it looks. There are many use cases that are well known and people have put a lot of thought into them. For example: Audit trailing, login users, and so on. We are looking for a good resource site that present the DB design for those common use cases. ...

Building a Large Table in MySQL

This is my first time building a database with a table containing 10 million records. The table is a members table that will contain all the details of a member. What do I need to pay attention when I build the database? Do I need a special version of MySQL? Should I use MyISAM or InnoDB? ...

Storing distances in MySQL

I have a "colors" table in my database. The user enters a color trough the user interface, and the backend searches for the most similar looking color existing in the colors table, calculating the distance of the colors in the HCL space. I will implement a caching algorithm, which should store the distance between previously calculated...