Re: [sqlite] Select name if exists in the group/table

2006-11-19 Thread Jay Sprenkle
\On 11/18/06, Micro Mega Dust <[EMAIL PROTECTED]> wrote: Hi, I'm a novice using databases, and I have a doubt about the working of SQL language: I have a system of user group, where each group is a table in sqlite_master, (each table of a group contains the UIDs of the members). But I don't know

Re: [sqlite] Select name if exists in the group/table

2006-11-19 Thread Micro Mega Dust
Ok, thank you Trevor Talbot and pepone. onrez. 2006/11/19, Trevor Talbot <[EMAIL PROTECTED]>: On 11/19/06, Micro Mega Dust <[EMAIL PROTECTED]> wrote: > I tried this query... > CREATE TABLE test ('foo', 'bar', UNIQUE('foo', 'bar')); > > I think that it work. It allow duplicate data in each co

Re: [sqlite] Select name if exists in the group/table

2006-11-19 Thread Trevor Talbot
On 11/19/06, Micro Mega Dust <[EMAIL PROTECTED]> wrote: I tried this query... CREATE TABLE test ('foo', 'bar', UNIQUE('foo', 'bar')); I think that it work. It allow duplicate data in each column, but not in both simultaneously. It is correct? This feature, it demonstrates than using a single ta

Re: [sqlite] Select name if exists in the group/table

2006-11-19 Thread Micro Mega Dust
2006/11/19, Trevor Talbot <[EMAIL PROTECTED]>: Why would that happen? This table exists only to express a single relationship between a user and a group. You would not insert duplicate data. It can be enforced with a UNIQUE constraint. How to avoid the duplicate data? Until this moment, I on

Re: [sqlite] Select name if exists in the group/table

2006-11-19 Thread Trevor Talbot
On 11/18/06, Micro Mega Dust <[EMAIL PROTECTED]> wrote: I create a separate table for each group, in order to avoid redundant data in the table. Your solution is interesting, but I think that allow redundancy in "GroupUsers". For example: +---+-+ |userId | groupIp | +---+--

Re: [sqlite] Select name if exists in the group/table

2006-11-18 Thread Micro Mega Dust
Hi pepone. onrez, I create a separate table for each group, in order to avoid redundant data in the table. Your solution is interesting, but I think that allow redundancy in "GroupUsers". For example: +---+-+ |userId | groupIp | +---+-+ | foo | groupA | <--- ! | bar

Re: [sqlite] Select name if exists in the group/table

2006-11-18 Thread pepone . onrez
you need a joing to display groups name select * FROM GroupUsers where userId='user' INNER JOIN Groups ON GroupUsers.groupId = Groups.groupId On 11/18/06, pepone. onrez <[EMAIL PROTECTED]> wrote: Hi Micro why you create a separate table for each group? usaly the groups are all in a singel tab

Re: [sqlite] Select name if exists in the group/table

2006-11-18 Thread pepone . onrez
Hi Micro why you create a separate table for each group? usaly the groups are all in a singel table I think is a veter aproact one table for users other for groups and a third table for the realtion betwen users and groups, you can view all the groups that a user beyons to with a select * FROM

[sqlite] Select name if exists in the group/table

2006-11-18 Thread Micro Mega Dust
Hi, I'm a novice using databases, and I have a doubt about the working of SQL language: I have a system of user group, where each group is a table in sqlite_master, (each table of a group contains the UIDs of the members). But I don't know how to get the groups of a user, in a single query. I tr