database-design

Creating a different user for each concern of my application!

I want to create my site and in the page have it so that the forum pages will use the forum mysql user having privileges on mydb.forum_table, mydb_forum_table2. and the profile page to use the profile user having access to mydb.users and mydb.profiefields and so on with the photogallery, blog, chat and... is this the right way to do it!...

performance between varchar(1) vs char(1)

Is there any performance difference between varchar(1) and char(1)? Which RDBMS handle these two datatypes and sizes in different ways? ...

Database design for email messaging system.

I want to make an email messaging system like gmail have. I would like to have following option: Starred, Trash, Spam, Draft, Read, Unread. Right now I have the below following structure in my database : CREATE TABLE [MyInbox]( [InboxID] [int] IDENTITY(1,1) NOT NULL, [FromUserID] [int] NOT NULL, [ToUserID] [int] NOT NULL, ...

Most efficient (for reads) way of modelling a One to Many relationship with EF4

This is a fairly simple question (or at least from the outset it should be). I am looking into efficient ways to model a One to Many relationship where the many is the same type. Example Say we have a Person Entity, and this person has 0 to many Sub-Persons, and the Sub-Persons have 0 or 1 Parent-Person. The answer should take into c...

Customizable user's addresses implementation

Hi, I am working on a billing system for service provider and I have to implement something named Customizable preferences schema. Main feature should be to allow administrator to define which fields are mandatory in various situations. E.g. if customer only registers on site, he has to enter first name, last name and e-mail address. If...

Database Design of Statistic Tool for a Widgets App

Hi everyone, We are working on a tool that will let developers create widgets and distribute to some publishers in our network. Publishers will be inserting these widgets to their websites. We want developers and publishers to see how many times (from which areas and some other statistical data) these widgets are displayed or interacted...

Storing many bits -- Should I use multiple columns or a single bitfield column?

Hello, I am designing a User table in my database. I have about 30 or so options for each user that can be either "allow" or "disallow". My question is should I store these as 30 bit columns or should I use a single int column to store them and parse out each bit in my application? Also, our database is SQL Server 2008 and 2005 (depen...

How to link a large number of items at one time in mysql and php?

For example: There are 10,000 items in a list and the user needs to be able to select a portion of these based on whatever criteria, and then put them into a group. So as the user, I filter the list of these 10,000 items based on whatever, hit select all and then click "Group". I'm trying to come up with the most efficient method of l...

Pictures & Tags - Database Design Question

I have 3 tables which allows me to get all tags of some picture, or all pictures with a specific tag. I would like also to know the number of times each tag exist. How could I get this info using MySQL ? Is it worth to add a "Count" column to the Tags table to hold this info ? Files Table File ID File Name ... ------- ------...

SQL Data Type to store Product versions

What data type should i use for a SQL column to store Product version eg. Version 0.1 0.1.1 0.2 1.1 1.1.647 2.0 ..... In query i should be able to sort them based on version number and i want an optimal query to find highest number. Thanks ...

Reordering an ordered list

I have a following SQL table with data ProductList id order productname 79 1 name1 42 2 name2 67 3 somename 88 4 othername 99 5 XYZ 66 6 ABC Display order is very volatile, it will change frequently, users will add or remove items and reorder the items. How should i handle this situation without ...

Does every user have their own database table?

For most major sites that you can preform CRUD operations does each user have their own database table? I would love to see an example of a database structure which multiple users, I'm looking at my wordpress database structure and just can't picture how twitter, tumblr, or even stackoverflow actually runs a database. Is it that easy to ...

SQL Server: What would be the appropriate way to define the relationships (borders) between states?

Suppose you have to build a DB tables that depicts states and their borders between each other. Let's say the States table would look like: States: Name(PK), Size, etc... What would be the appropriate way to define the relationships (borders) between states? I came up with three alternatives - Defining a Borders table with primary k...

Feedback system like Ebay but for events: DB schema

I'm creating a feedback system kind of like Ebay. (Once you buy the item you can then leave feedback upon its purchase) But instead of products its events (partys, meetings). Users can attend the event and then only the users that confirmed their attendance can leave feedback once the event is finished (known by an event_over boolean). ...

Relationships and data modeling in document oriented databases

I just read a few articles on data modeling and relationships in document oriented databases (... anti pattern, CouchDB article, MongoDB article ...). There are certain "issues" about which I would like to talk and hopefully find a solution/pattern to stop them deluding me. There is a common saying that you should stop thinking like you...

Data model: parent and child 'dual' relationship

I am trying to create a proper parent/child relationship within my data model. I have a typical one to many relationship between the parent and children. I am wondering if I have parents that know about their children, is it 1) ever acceptable and 2) a good idea for each child to specifically know about its parent. (a child can only hav...

Whether to Split Data in to Separate PostgreSQL Table

I am creating an app with a WPF frontend and a PostgreSQL database. The data includes patient addresses and supplier addresses. There is an average of about 3 contacts per mailing address listed. I'm estimating 10,000 - 15,000 contact records per database. When designing the database structure, it occurred to me that rather than storing...

Suggestion for better relational DB Schema

Hi, I am here to design a relational database schema that models polling and users. Each category can have one or many questions. Each user can participate only once at each category, and can poll (or not) exactly once on each question. Each poll is yes, no, or abstain (no vote). I have designed my schema with four tables: users, [u...

How to create Facebook like friends system in php with mysql

I want to create a friends system like facebook, well quite weird than that. When a user adds someone, the someone will be notified, if agree then they'll be mutual friends(in this case, meaning both parties are friends, literally) or if the someone leaves the request unresponded, they'll become fan of the someone. The someone reject the...

Need suggestion on Database Design

In my web application project i have packages, modules and documents (such as creatememo, createcircular,CreateEmployee). in my database i created tables for packages, associated modules and objects (employee, memo, circular). then i have action table that defines applicable actions on each object e.g create, List, edit, print etc. now i...