database-design

How to store tags in MySQL tags, one field in total or one filed for each tag?

I am developing a product which is close to stackoverflow.com. A poster is required to enter tags for his problem or task. How to store these tags in the database, one field(column) in total or one field(column) for one tag? ...

Visualizing nHibernate model.

Hello, I'm designing a data model using Fluent nHibernate and I'm wondering how to visualize entites, relations and stuff for documentation purposes. This is my first project using Fluent nHibernate. My previous projects were build on Linq2Sql but recently I was a bit annoyed about some L2Q concepts and finally I decided to do a switch ...

Is it bad to use user name as primary key in database design?

I was told by a friend: What unique key do you use? I hope you are not saving the entire user name --- this will use up too much table space! Assign an unique userID to each (unique) userNAME and save this userID (should be INTEGER UNSIGNED auto_increment or BIGINT UNSIGNED auto_increment). Don't forget to create a re...

Example of a database table design with a questionable repeating group

I am having a discussion with someone about the following table that is used to link client-specific items: Table LINK: Client (int) Item1 (int) Item2 (int) This is the disputed design. All three fields refer to other tables. The two Item fields refer to the same other table. These are not real field names, so don't bother with ...

mysql - table design for embeding system

I am working on an embedment section on my site where users can embed different media from various services, youtube, myspace music, vimeo etc I am trying to work out the best way to store it. Users do not have to embed all of the options and can only embed one of each type (one video for example). Initially I thought just have a table...

SQL Join without multiple LEFT

I have the following tables in an SQL DB Vehicles, RepairCharges, TowCharges, There will always be only 1 record for Vehicle, but multiple records for the other tables. My current LEFT OUTER Join works however if there are multiple entries in the joined tables then its returning just as many rows. My question is, I need to create a SQ...

Questions on Auction Database Schema

I was looking at the following db model and I had some questions on it. I'm sure it's a good design as the guy behind it seems to be reasonably well qualified, although some things don't make sense: Why's he seperated out bidders and sellers? I thought you'd have users, and users can place bids and sell items. You'd have a bids table w...

Database Design for Filtering Database

Hi All, I'm new to complex database design. I'm currently into a project where the user should be able to retrieve Instructions based on a combination of 18 columns. So my parameter Table has the following columns Job State Manager ProcessCode ProcessType (rest of the columns truncated). InstructionID (FK of Instruction Table) When...

SQL-Server: Define columns als mutually exclusive

Hi, joking with a collegue, I came up with an interesting scenario: Is it possible in SQL Server to define a table so that through "standard means" (constraints, etc.) I can ensure that two or more columns are mutually exclusive? By that I mean: Can I make sure that only one of the columns contains a value? ...

how to design a database to save data whose structure is not always known during design, and could change later?

sites like IBM's many eyes, swivel etc store varieties of data and allow their users to visualize them. How do they design their tables? For example, if you were to save the data from data.gov site into a database and allow your users to perform operations on it, how would you go about designing the tables? The structure needs to be gene...

SQL: Best practice to store various fields in one table

Hi, I want to design a table for items. There are many types of items, all share several fields. Each type of item has it's own fields. I want to store the uncommon fields in a separate table. I thought of something like : ----Items +Item_id +Item_Type_Id +Item_Serial ... ----Item_types +Item_Type_Id +Item_Name ... ----Item_Fields +I...

Building a Contact Database - Need a little schema inspiration.

I've been working on laying out the data structure for an application I'm working on. One of the things it will need to handle is storing customer / contact information. I've been studying the interface of a few different contact information programs like Address Book, gmail contacts, etc. I have basically boiled the contact down to ...

Fixed Timetable DB Design

I want to let my users specify which hours / days they want to be contacted, I though of creating a fixed timetable with the 7 days of the week and let the user specify which hours he has free. I'm having a little trouble figuring out how I would store that info in the database, can anyone help me with a good table design for this situa...

MySQL: Duplicated Data VS More Queries

Please take into consideration this is a MySQL Question for Web Development. Currently I'm designing the database structure for a User Authentication System and I came across one question, that I myself can't figure it out: Is it better to have duplicated data instead of making more queries? Here's a little background, currently my us...

Database Tables, more the better?

Lately I've been rethinking a database design I made a couple of months ago. The main reason is that last night I read the databse schema of vBulletin and saw that they use many, MANY, tables. The current "idea" I'm using for my schema, for instance my log table, is to keep everything in one table by differencing the type of Log with an...

Should I use an index column in a many to many "link" table?

I have two tables, products and categories which have a many to many relationship, so I'm adding a products_categories table which will contain category_id and product_id. Should I add another (autoincrementing) index column or use the two existing ones as primary key? ...

How to collaborate on mysql schema?

I'm working with another dev and together we're building out a MySQL database. We've each got our own local instances of MySQL 5.1 on our dev machines. We've not yet been able to identify a way for us to be able to make a local schema change (eg: add a field and some values for that field) and then export some kind of script or diff file...

Do link tables need a meaningless primary key field?

I am working on a couple of link tables and I got to thinking (Danger Will Robinson, Danger) what are the possible structures of a link table and what are their pro's and con's. I came up with a few possible strictures for the link table: Traditional 3 column model id - auto-numbered PRIMARY table1fk - foreign key table2fk - foreign ...

Is it a good practice to use email address as a primary key in many tables in a website system?

For example, a website like stackoverflow.com, is it a good practice to use email address to identify users in many tables? Is it bad if the primary key is very long, say varchar(50) or even varchar(100) ? ...

How to fight flooding for a website?

I know,time restriction implementation as adopted on stackoverflow.com is a way to fight flooding. But sometimes I really want to input another message soon after I input a previous one and I want to wait until the time restriction is lifted. Is there other elegant way to fight flooding? ...