database-design

DB Design to store custom fields for a table

Hi All, this question came up based on the responses I got for the question http://stackoverflow.com/questions/2785033/getting-wierd-issue-with-to-number-function-in-oracle As everyone suggested that storing Numeric values in VARCHAR2 columns is not a good practice (which I totally agree with), I am wondering about a basic Design choice...

I need to create a contest....

I'm working on a contest where users vote for contestants. Each contestant will have a bio. I was wondering what would be the best way to approach this? Should I do this in php or javascript? Should I use a database to collect data? Should I use sqlite3? If I use sqlite3 how do i install that on my mac? I'm very new to all this but I'm a...

database deign advice wanted: double data entry

hi, I'm designing a database for capturing clinical trial data. The data are entered twice by two persons, independently and the results must be matched. What are the best database tools to use to achieve the best results. Any one has similar experiences? Your helps are highly appreciated. thanks. ...

User role permissions for different modules using bitwise operators

So I have an application that has several modules (think of modules as different pages), each module has a set of permissions; view, add, edit, delete I want each user role to have privileges for each module, for example Role A Permissions Module 1 -> view Module 2 -> add, edit Module 3 -> view, add, edit, delete etc. H...

To share a table or not share?

Right now on my (beta) site i have a table called user data which stores name, hash(password), ipaddr, sessionkey, email and message number. Now i would like the user to have a profile description, signature, location (optional) and maybe other things. Should i have this in a separate mysql table? or should i share the table? and why? ...

Which one scales better?

I have to make a design decision with regards to fields in the database. Given: users table Problem: Visually we have a check box that says: [*] check this box to not show this again Should this data(boolean) be saved in the users table in a column or in a new joint table that has the user_id? Which one scales better? faster? ...

How do i do this : Define/Model Database Online

There are many IDEs to create database schema pictorially. I was wondering as to how I can do it online? Are there open source codes/libraries/applications which already do this? Basically, what i am looking at is : let the user define a table and the columns - which in common man's term is : define relations etc pictorially. The pictu...

How should I implement items that are normalized in the Database, in Object Oriented Design?

How should I implement items that are normalized in the Database, in Object Oriented classes? In the database I have a big table of items and a smaller of groups. Each item belong to one group. This is how my database design look like: +----------------------------------------+ | Inventory | +----+------+-...

This is right way for database?

Hello, i have some issue with database. Okay, i have two models -> Page and Item. Page for displaying some content. Item -> this is item discription. So, i work on small ecommerce shop. Okay, all of this models can have some comments. So, this is my Comments model at this moment: Comments -> string : id text : body integer : page_i...

index 'enabled' fields good idea?

Content of a website is stored in a MySQL database. 99% of the content will be enabled, but some (users, posts etc.) will be disabled. Most of the queries end as WHERE (...) AND enabled Is it a good idea to create an index on the field 'enabled'? ...

how to design a schema where the columns of a table are not fixed

I am trying to design a schema where the columns of a table are not fixed. Ex: I have an Employee table where the columns of the table are not fixed and vary (attributes of Employee are not fixed and vary). Frequent addition of a new attribute / column is requirement. Nullable columns in the Employee table itself i.e. no normalization ...

many-to-many-to-many, incl alignment of data from diff sources

Re-factoring dbase to support many:many:many. At the second and third levels we need to preserve end-user 'mapping' or aligning of data from different sources, e.g. Order 17 FirstpartyOrderID => aha LineItem_for_BigShinyThingy => AA-1 # maps to 77-a LineItem_for_BigShinyThingy => AA-2 # maps to 77-b, 77-c LineItem_for_LittleWi...

Voting Script, Possibility of Simplifying Database Queries

I have a voting script which stores the post_id and the user_id in a table, to determine whether a particular user has already voted on a post and disallow them in the future. To do that, I am doing the following 3 queries. SELECT user_id, post_id from votes_table where postid=? AND user_id=? If that returns no rows, then: UPDATE po...

Writing csv files with python with exact formatting parameters

I'm having trouble with processing some csv data files for a project. Someone suggested using python/csv reader to help break down the files, which I've had some success with, but not in a way I can use. This code is a little different from what I was trying before. I am essentially attempting to create an array. In the raw data fo...

Database warehouse design: fact tables and dimension tables

I am building a poor man's data warehouse using a RDBMS. I have identified the key 'attributes' to be recorded as: sex (true/false) demographic classification (A, B, C etc) place of birth date of birth weight (recorded daily): The fact that is being recorded My requirements are to be able to run 'OLAP' queries that allow me to: 's...

What data type to use for variable length data (for performance)?

What data type should I use for data that can be very short, eg. html link (think twitter), or very long eg. html blog post (think wordpress). I am thinking if I use varchar(4000), it maybe too short for a html formated blog entry? but if I use text, it will take up more space and is less efficient? [update] i am still condering usin...

Dynamic data-entry value store

I'm creating a data-entry application where users are allowed to create the entry schema. My first version of this just created a single table per entry schema with each entry spanning a single or multiple columns (for complex types) with the appropriate data type. This allowed for "fast" querying (on small datasets as I didn't index al...

User account design and security...

Before I begin, I am using Ruby on Rails and the Devise gem for user authentication. Hi, I was doing some research about account security and I found a blog post about the topic awhile ago but I can no longer find it again. I read something about when making a login system you should have 1 model for User, this contains a user's usernam...

database structure

I have a table named ActivityRecording. This table currently has 500,000 records. I need to add a lot of new inputs that relates to activityrecording table. The relation of activityrecording with these new input fields is 1 to 0,1. So, what's going to happen on screen is when user fills the ActivityRecording data, he will then be taken ...

Physically cluster a MYSQL table for better performance

I have a 30M row table, which is indexed by ID now. However, a lot of the requests are around a much smaller subset, which is identified by app_user=1 Does it make sense to physically cluster the table according to this? If so, how can I do so? ...