database-design

Database Design: Relationship example between Credit Card and Credit Card Type

A generic example that will help me understand database relations better: 3 tables: | Credit Card | | ID | | Card # | | Credit Card Type | | ID | | Type | where CreditCardType.Type could be AMEX, Visa, MasterCard. | Customer | | (PK) ID | 1.) It seems that I don't need an ID field for Cred...

database structure question, for multiple questions ramdomaly called.

I want to create a website for training multiple choice questions, the problem is that i don't want to repeat the question for each user, i will have many questions and the probability that random gets the same question is very small, and its important for me that user doesn't see the same question, so is it so pad demand to do this? and...

Database design - Similar Contact Information for multiple entities

Hello. I realise that the answer to these types of questions are often "it depends" but still I wondering what the general consensus might be. I am dealing with multiple entities such as Company Charity Auditor Stocktaker etc etc... Which all have contact information such as e-mail, telephone and address. The two design metho...

MySQL: One row or more?

I have any kind of content what has an ID now here I can specify multiple types for the content. The question is, should I use multiple rows to add multiple types or use the type field and put there the types separated with commas and parse them in PHP Multiple Rows `content_id` | `type` 1 | 1 1 | 2 1 ...

Database design help needed

I am a large social networking site, say mynetwork.com. It will have a lot of features like albums, forums, jobs board and so on (Php + MySQL + Yii) Now, the users of this site will be able to create networks for their own community which can be accessed by community-1.mynetwork.com or community-2.mynetwork.com etc. So, I am not sur...

representing login in ER diagram

Hi Guys, I'm trying to develop a system, and doing the ER diagram now, i have two questions I'm always thinking about the process and trying to do the ER, now i'm so confused i can't really think and do it, even though i have a knowledge in databases, how to over come this? how to represent a login in the ER? please elaborate guys? ...

Would you consider this a natural primary key?

Hi everyone. I'm writting a program with users who are identified by an id called RFC. In Mexico, this RFC is a 13 characters string used to identify tax payers in our country. No one, in the whole country, has the same RFC so I thought this would be a perfect natural primary key. This RFC would serve as a foreign key in other tables. T...

Best way to store and retrieve comment replies in sql server

Hi, I want to store comment replies in database table. I have a table to store comments: comment_id comment_par_id, comment_from comment_text comment date .... New comment has par_id=0 while the replies has par_id set to comment id to which it was replied. The nesting is just one level. Reply to a reply also has the same parent id. ...

MYSQL / opening and closing connections or keeping one open per browser user?

Hi, If I were designing a new system, should I have each function open and close the mysql connection as and when needed OR should I form one connection and keep that as a "globally accessible variable" for that browser session? Why is it a bad idea, if indeed it is? ...

What are the pros and cons of the following database design?

I am looking to for suggestions and commments about the following design. All the tables are expected to be large tables (millions of records) and are updated and queried often and any kind of update is allowed (update, insert, delete). -- product create table Product( productID int not null identity(1,1), name varchar(100) not null, ...

How to maintain an ordered table with Core Data (or SQL) with insertions/deletions?

This question is in the context of Core Data, but if I am not mistaken, it applies equally well to a more general SQL case. I want to maintain an ordered table using Core Data, with the possibility for the user to: reorder rows insert new lines anywhere delete any existing line What's the best data model to do that? I can see two wa...

What might be the best method of storing Mandelbrot values in a database?

I'm currently experimenting with rendering a Mandelbrot set and I've quickly come to realize that it would be useful to not have to recalculate the maximum iteration count for each rendering...on the other hand it's a lot of data to keep track of. It seems to me (based on my limited experience with RDMSes) that a relational database is p...

Efficient database design for frequent logging of small things.

I have a database which stores temperature-logging data from various instruments. Data may be logged as often as once per minute. One approach to designing a log table would be to put each log entry in its own row along with the device ID, a time stamp, and a sequence number (even if the clock on a device is changed, it should be possi...

What would it mean If I change the identifying relationship from this part of a database design to a non-identifying relationship?

Hi all, I have a question regarding with this database-design. I am a bit unsure of the difference between identifying and non-identifying relationships in a database leading me to some puzzles in my head. I have this database design: *(kind of like a movie rental stores. "friend" are those who borrow the movie. "studio" is the product...

SQL Server 2005 Database Designer

Hello ! Does anyone know a good and free Database Designer able to export the design into SQL Server 2005 ? I have been using PowerAMC for 2 weeks but it was the trial. PowerAMC is the only program I know with a Conceptual Data Model Designer. Thank you. ...

Is denormalizing acceptable in this case?

I have the following locations table: ---------------------------------------------------------- | ID | zoneID | storeID | address | latitude | longitude | ---------------------------------------------------------- and the phones table: ----------------------- | locationID | number | ----------------------- Now, keep in mind that f...

difference between User and Account object in social network design?

I am building a data model for a social networking site and lost of how to model Users and Accounts. 1) User signsup and creates an Account. So we assign the User a user Id like on most social websites we see which is same profile ID. Now is that the account ID too? OR is there a separate account ID also hidden? If user can have multipl...

What is the best practice to represent multi dimensional data in tables?

Hi all, I have survey statistics - for each answer (there is an arbitary number of answers) - I need to know the age group and the income group. (E.g. - answer "a" was answered by 23 people of ages 30 to 35, and by 11 people with income level of 10,000 to 15,000. and by 7 people of ages 30 to 35 with income level of 10,000 to 15,000 (thi...

Is storing a comma separated list in a database column really that bad?

Imagine a web form with a set of checkboxes (any or all can be selected). I chose to save them in a comma separated list of values stored in one column of the database table. Now, I know that the correct solution would be to create a second table and properly normalize the database. One reason was laziness, my SQL knowledge is very limi...

What's needed to develop a database in the cloud?

What is needed (in general terms) to create a service like MongoHQ or SimpleDB? Thank you ...