database-design

A study in JOINs with many-to-many relationships

Consider, if you will, the following tables: This may seem like a strange structure, but allow me to explain. The goal of this structure is to create a report listing all people, excluding those on vacation (for simplicity, we'll pretend that the vacation record will only exist if a person is on vacation.) The reason I have the Vaca...

Creating a cron job for job pool for my membership website - whats a good table design?

Hi guys I want to set up a job pool for my membership based website. Users on my website can choose to execute certain tasks that take a while to be done like sending invite emails etc. Instead of having it be run on a form submit, I was thinking of creating a table where an entry would be made for the job requested. Eg a user wishes to ...

How to design tables when using multiple languages

How do you suggest to Design tables when working with multiple languages on a site? Say for example that we have a table called product. That one might contain stuff like SKU, price, sort order and other settings. The name, and description however will be available in several languages. should these texts be in individual tables like: t...

I need help designing my oo database to handle multiple kind-of relations

i'm currently creating a database program in java and i am a bit stuck with the design. it's pretty straight-forward until i hit the part where there are more than 40 different kinds of activities that can range from from book-selling to tutorials to radio/tv show appearances. each activity type has a different set of properties, such as...

Denormalization in Google App Engine?

Background:::: I'm working with google app engine (GAE) for Java. I'm struggling to design a data model that plays to big table's strengths and weaknesses, these are two previous related posts: http://stackoverflow.com/questions/3120192/database-design-google-app-engine http://stackoverflow.com/questions/3125115/appointments-and-line...

Normalization/Schema for classifying cross-browser bugs based on rendering engines and browser versions?

I'm trying to decide on a schema for storing cross-browser bugs across all the rendering engines. Here's what I had in mind: browser_engines table: id name version 1 gecko 1.5 2 gecko 1.7 3 gecko 1.8 4 gecko 1.9.0 5 gecko 1.9.1 browser_versions table: id name version engine_id 1 firefox 3.0 4 2 firefox...

Ideas about data normalization

I'm designing an app for work management. The work can be broken down in (technically) infinite levels using a WBS (Work Breakdown Structure). When defining the job/task numbers for each level, what is the best way to normalize the task/job reference data (i.e. Job Number)? For example, I have 5 Reference fields for Identifying tasks/j...

.Net application design

Hi, We are making an application with the details below. 1) Web/Desktop App on C#.Net 2) Stores users activity timestamp as a datetime field. We need to store this timestamp in UTC format. Now, while displaying it will be converted to user's timezone. Problem The user can float from one office to another. (multiple offices all in ...

Representing "X of Y" in SQL

In my database, I have a lot of courses that are compulsory. Some are elective. However, there are courses of a third kind: A list from which you have to choose X courses. The list (and the number X) is different for each study program. How would you represent this relationally? ...

Which approach to store static data is better?

I am developing a web application about books. We all knows that books have different category. So, this category is basic on a sequence of number, for example, 200 = computer related, 800 = history. Each book is beyond to one category only. Here is the question. I have a category list, it may expand in the future. For example, new tec...

Is this necessary to point back the relationship?

Here is the situation: I have a table called "books", and a table called "categories". Each "Book" is belong to a category, so the book have a field called "category id". But it is necessary for making a "categoryList" to store "book id"? I can use a select statement to find the books that belongs to categories, but is it a better approa...

How to implement a super class, sub class relationship in the database?

If I have a class called animal, dog and fish is the subclass. The animal have attribute called "color". Dog have the attribute called "tail length", and the fish don't have this attribute. Fish have the attribute called "weight", the dog don't have this attribute. So, I want to design a database to store this information. What shoul...

Best Practice for Foreign Key column position in table

This might be a silly question, but here goes: Is there a standard or best practice, which specifies in what order the foreign key columns in a table should? I for one like the idea of the PK being the very first column in the table, followed by all the foreign keys, and then the columns thats relevant to that table.. Other way of do...

How to implement this logic in database?

Here is the situation: I have a "user" , which have many attributes. For example, "name", "email", "password", "phone". There are some attributes that are open for public, for example, "name", "email". These information is open for evenbody who visit the site. But some, only for trust body in the system, for example "phone". These i...

Database Design Question

I have the following situation and would like to know your opinion and inputs. My applications has a company. Each company has a lot of departments, which in turn has a lot of users. I have a calendar at all the levels. So there is a central calendar for the company, and separate calendar for each departments, and separate calendar for e...

How many columns is too many columns?

I've noticed that a lot of folks here cite tables with 20+ (I've seen as much as 55) columns in one table. Now I don't pretend to be a database design expert, but I've always heard that this is a horrible practice. When I see this, I usually suggest splitting into two tables with a one to one relationship: one containing the most frequ...

Config files vs database tables

The scenario I am particularly interested is multiple servers having daemons that run on certain configuration parameters. (since, this is a learning exercise. i welcome any thought beyond this particular case) The question is, where should the configuration parameters sit. A. a central database table B. a config file pushed to each o...

Need your input on creating tables

I just want some advice about mysql database. I'm creating a new database for hired cars that need servicing and repairs. I have created 4 tables. Car_id is linked to a primary key table with car information. I was thinking of putting the repair_id and service_id with in the car data table. But that means it will have 3 primary keys in ...

Hierarchical database "next in sequence" with Rails?

I am building a site that has some ordered, hierarchical data stored in the database. There's a "Volume" table, a "Book" table that has volume_id and position fields, and a "Chapter" table that has book_id and position fields. What I'd like to build is a browser that steps through the sections. So, if I'm rendering the details about V...

Will this (normalised) database structure permit me to search by tags as I intend?

Hello, I am trying to set up a normalised MySQL database containing the three following tables. The first table contains a list of items which can be described by various tags. The third table contains the various tags used to describe the items in the first table. The middle table relates the other two tables to each other. In each...