Question

I need your help for a functionnal question about data storage.

I'm on a project where the user can save a sort of excel table on the server. The size of the tables isn't fixed.

What is the best solution to store the tables ? As an array stored as a text in my MySql database ? Using MongoDB or other NoSQL solution ?

For information, no search feature will be implemented on the tables.

Thank you a lot!

Edit: I add two examples of data table:

Example 1: sales per quarter per salesman

            Sven    Kenneth
2013.Q1     1200    4500
2013.Q2     1350    900
2013.Q3     2487    784
2013.Q4     4570    4512
2014.Q1     4785    3451

Example 2: weight of a couple and their children per months

       Him    Her    Children
Jan    70.5   52.1   45.1
Feb    71.8   52.7   46.1
Mar    70.8   52.7   46.0
Apr    70.1   51.9   46.1

The number of rows and columns of these two example isn't the same and can vary in time: next quarter, the company can hire a new salesman.

How to store these data? Note that never the user will search on these tabels.

I hope this is clearer.

Was it helpful?

Solution

In order to solve

The number of rows and columns of these two example isn't the same and can vary in time: next quarter, the company can hire a new salesman.

back in the old days where we use relational tables we would decompose it in two tables

period | salesman | sales
2013.Q1  Sven       1200    
2013.Q2  Sven       1350    
2013.Q3  Sven       2487    
2013.Q4  Sven       4570    
2014.Q1  Sven       4785   
2013.Q1  Kenneth    4500
2013.Q2  Kenneth    900
2013.Q3  Kenneth    784
2013.Q4  Kenneth    4512
2014.Q1  Kenneth    3451

salesman   | id
Sven L       Sven
Kenneth W    Kenneth

this is not normalized up to 5th normal form but it would do.

you could use Cassandra or Mongo, Cassandra you could use super column families that allows you to create columns on the fly and MongoDb it isn't a rigid structure you are saving only json objects you could be saving only quarters like so:

{
"quarter" : "2013.Q1", 
"salespeople" : [
    {"salesman": "Sven", "sales" : 1200},
    {"salesman": "Kenneth", "sales" : 4500}
 ]
}

and next year

{
"quarter" : "2014.Q1", 
"salespeople" : [
    {"salesman": "Sven", "sales" : 1200},
    {"salesman": "Kenneth", "sales" : 4500},
    {"salesman": "Somebodyelse", "sales" : 100000}
 ]
}

you can do both ways but relational way is so much easier

OTHER TIPS

I didn't find an explicit answer but I will explain what I'll do.

I will simply store the result as a bidimensional array.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top