I have the two following tables for testing:

Test1)  rowid | class | join_value
            1 | 'one' | 1
            2 | 'two' | 2

Test2)  rowid | type | join_value
            1 | 'number' | 1
            2 | 'string' | 2

and peform the following query:
select * from test1 natural join test2

I expect the following:
test1.rowid | test1.class | test1.join_value | test2.type
1 | one | 1 | number
2 | two | 2 | string

but I instead get the following:
test1.rowid | test1.class | test1.join_value | test2.type
1 | one | 1 | number
2 | two | 2 | string
1 | one | 1 | number
2 | two | 2 | string

Why are my data duplicating rows? I've been over the SQL statement in books and this is the way it demonstrates this query, but the SQLite results don't match what the books say to expect. I even tried this:

select test1.class, test2.type from test1 natural join test2 group by class, type

But still get duplicates.



Reply via email to