mardi 4 août 2015

View vs Tables in SQLite

I have a Table where I save daily data TDay.

Task    | Time  | Day | Month | Year |
--------------------------------------
Cooking | 20min | 21  | 03    | 2015 |
Reading | 20min | 21  | 03    | 2015 |
Smiling | 20min | 21  | 03    | 2015 |
Washing | 20min | 21  | 03    | 2015 |
Cooking | 20min | 22  | 03    | 2015 |
Reading | 20min | 22  | 03    | 2015 |
Smiling | 20min | 22  | 03    | 2015 |
Washing | 20min | 22  | 03    | 2015 |
Watching| 20min | 01  | 04    | 2015 |
Washing | 20min | 01  | 04    | 2015 |
Reading | 20min | 01  | 04    | 2015 |
Ironing | 20min | 01  | 04    | 2015 |

Now i would need a VIEW or a Table TWeek and TMonth that gathers those results

TWeek

Task    | Time  | Week | Year |
-------------------------------
Cooking | 40min | 12   | 2015 |
Reading | 40min | 12   | 2015 |
Smiling | 40min | 12   | 2015 |
Washing | 40min | 12   | 2015 |

TMonth

Task    | Time  | Month | Year |
-------------------------------
Cooking | 40min | 03    | 2015 |
Reading | 40min | 03    | 2015 |
Smiling | 40min | 03    | 2015 |
Washing | 40min | 03    | 2015 |
Watching| 20min | 04    | 2015 |
Washing | 20min | 04    | 2015 |
Reading | 20min | 04    | 2015 |
Ironing | 20min | 04    | 2015 |

So what I am doing is to gather the results daily and sum the up for a week and a month. The Problem is that I am expecting a lot of data.

Should I use views for that or should I write a small programm that fills tables? Or is it smarter to make a Select where I sum up the data? In the and I will represent a result.

Aucun commentaire:

Enregistrer un commentaire