Re: how to design db

From: ilochab <ilochab_at_lycos.it>
Date: Wed, 10 Dec 2008 15:09:16 GMT
Message-ID: <wYQ%k.10438$J84.7856_at_tornado.fastwebnet.it>


Il Mon, 08 Dec 2008 20:29:16 +0100, Volker Hetzer ha scritto:

> ilochab schrieb:

>> I'm using sqlite.
>>
>> I need a DB that contains:
>> - a set of general tables
>> - a variable number of sets of users tables.
>>
>> The first set is accessed by every-one. Each of the users' set 'is
>> identical in structure to the others, but it is specific in content
>> respect to the owner.
>>
>> I can manage authentication through my application. What I don't know
>> how to do in a suitable way is the design of a group of identical
>> tables repeated for each user.
> Bob is right, that's not the way to do it. Instead, you have one table,
> with the user id in one column as part of the key. Then you can have
> views that add a "where user = getusername()" or something to your
> queries and instead-of triggers for DML. If it's not a cellphone, I'd
> suggest you consider a bigger database system like mysql, or sqlserver
> express.
> 
> Lots of Greetings!
> Volker

You are both really rigth (of course), but let me specify a little more my situation.

My DB is not big, and the application is not a production one (it's just a diet journal http://dieta.sw.googlepages.com/). It's a GUI application that can be run by multiple user, but only one at a time.

I thought to install the main db (with base data like aliments' definitions) nearby the binary code and a db with user's specific data in each home directory.

I understand quite well that if, for any reason, the two data stuctures do not evolve together they become unusefull. This is why I asked for help.

I thank you for the answer and I wait for a followup.

Ciao
Licia Received on Wed Dec 10 2008 - 16:09:16 CET

Original text of this message