database-design

How to represent the data for threaded comments(along with comment voting) in mongodb?

For my blog, I want to incorporate my own commenting system without relying on the default wordpress commenting system. I need the comments module to utilize mongodb instead of mysql and the module needs support for the following: Threaded comments Comment Voting The votes on comments need to be aggregated per each comment author f...

MySQL with Soft-Deletion, Unique Key and Foreign Key Constraints

Say I have two tables, user and comment. They have table definitions that look like this: CREATE TABLE `user` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `username` VARCHAR(255) NOT NULL, `deleted` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY (`username`) ) ENGINE=InnoDB; CREATE TABLE `comment` ( `id` ...

(free) tool to create word database design/shcema document from a sql server database

Looking to document a database schema after the event. I know red gate software have a commerical tool for this. I'm looking for a free tool to generate a word document from a SQL Server database. ...

One-to-one relationship or One-to-many?

Maybe I need more coffee this morning but here goes... I have a very simple inventory system. Right now I have two tables: Items and Inventory. Items Id Title YearReleased Inventory Id ItemId(Foreign key to Items) Quantity QuantityOnHand Each item has one inventory and each inventory belongs to one item. The relationship betwe...

How do you store sales ?

Hi, How would you store sales ? I though about storing a serialized array which contains the products ordered vs a sale_product table with a foreign key referencing products ordered. What are you thoughts about this ? Any experience with one of these ? Ty ...

Most efficient database design for a blog (posts and comments)

What would be the best way of designing a database to store blog posts and comments? I am currently thinking one table for posts, and another for comments, each with a post ID. It seems to me, however, trawling through a large table of comments to find those for the relevant post would be expensive, and would be done every time a blog p...

Database Modeling an Email List and Report Types

I'm having a huge problem in modeling this problem. I'm writing a exam taking application (in MS-Access, but this isn't really relevant) and there are a few reports that need to be sent out. The first report is sent out automatically after a person completes an exam. The second report is sent out every 2 weeks (or whatever they want to ...

Which database(s) should I use?

Hi, I'm building an application that needs to query a lot of data that is written once and not changed anymore. Should I use MySQL for that or should I use something like SimpleDB or BigTable? (I need to write once, read many times) Thank you. Edit: I want to use Heroku, big for me is more than 5MB. "Thousands of rows" take more than ...

Database Schema For Task Reporting

I have a task tracking application, which is very basic. It currently has a number of tasks and the progress is updated as the tasks get completed, from 0 to 100%. The problem is, this data is all very transient and I want to add reporting over the top of the tasks, so things like: Number of tasks added between two dates Number of tas...

How to generate a diagram of a very large database schema (SQL Server)

I have a very large database I need to diagram. The database is SQL Server 2008 on x64. It is large in that there are hundreds of related tables, each with up to 2000 fields (some are sparse), multiple relationships between tables (often hundreds per table, in fact), multiple schemas... you get the idea. I tried to use the Database Diag...

many to many table - 1 seperate field primary key or 2 existed fileds primary key (Example inside)

Hi, I have 2 tables with many to many relation: student ( id int(11) NOT NULL, name varchar(255), primary key(id) ); teacher ( id int(11) NOT NULL, name varchar(255), primary key(id) ); and I should do 3 table - student_has_teacher option add id separate field primary key student_has_teacher ( id int(11) NOT NULL, teacher_i...

storing school names in a database schema

I'm designing a schema for an event registration system which will involve students from schools across many different regions. My main problem is the method by which I store school names in the database. Given that students will be registering separately, it's highly likely that spelling variations of the same school name will accumula...

MySQL DataBase design Question

I'm thinking of the best way to design a database given the following situation. There are over 1000 hotel room units. Each hotel room unit has a list of about 100 individual types of items with a qty attached to them. The inventory is standard for each hotel room. But the qty of each item can be changed. For example 3 coffee mug...

Can I (theoretically) use a Collection (e.g., Array, List) as a foreign key in a relational Database schema?

Is is possible to use a Collection such as a Multiset or Array as the foreign key in a database scheme? Background: A student proposes to use such a construct (don't use a join table for the n:m association) to store the following object structure in a database public class Person { String name; List<Resource> res; … } pu...

Database schema dilemma with foreign keys pointing to multiple tables (exclusive arc)

Hopefully my description is a little better than the title, but basically I'm having an issue with one part of a new application schema and i'm stuck on what is the most manageable and elegant solution in table structure. Bare bones table structure with only relevant fields showing would be as follows: airline (id, name, ...) hot...

User, customer, admin account in 3 different tables?

In my web application I will have three types of accounts. User: for using the web application for free Customer: for advertising and getting a Company Logo Admin: for editing and deleting stuff Should all these three be in separate tables or in one with a column named "account_type" where i can mark it as User, Customer or Admin? W...

Splitting mysql database per client

I am working on a database that is relatively small. It has a total of 67 tables, with a little over a million records. It is about 254 MB. The application that works with it has been running for about 5 years and the amount of usage has doubled each year. This year we are projected to triple which will just almost double the database in...

Need advice on archiving large SQL Server tables

Our SQL Server databases (SQL Server 2008 Standard edition, so to be R2) are getting bigger and bigger from years of data gets stored. So we are thinking of moving the old data (possibly older than a year) into an archive database. There are many reasons why we would benefit from having our production databases smaller. This is how I pl...

Is normalizing the gender table going too far?

I am not a database guy, but am trying to clean up another database. So my question is would normalizing the gender table be going too far? User table: userid int pk, genderid char(1) fk etc... gender table: genderid char(1) pk, gender varchar(20) Now at first it seemed silly to me, but then I considered it because i can then have a ...

how much data can a 5MB SQL database store?

Hi, I'm interested in using Heroku for my project. I'm not interested in paying for it at the moment but the free plan only offers a 5MB database. Is there any measure I can use to know how many columns/rows of simple text data can be stored in a 5MB database? Thanks ...