I have never worked with 2 tables in a many-to-many relationship and could use 
some help. 



I have done some research and have the following understanding: 



given: 



table a 

   _id integer primary key, 

   a_data varchar(40); 



table b 

   _id integer primary key, 

   b_data varchar(40); 



I should define a 3rd table - 

table a_b 

   aID integer not null, 

   bID integer not null; 



where - 

aID is the _id field from the "a" table 

bID is the _id field from the "b" table 



My questions are: 

    

   What would an "insert" statement look like that inserts data into table "a" 
and table "b", gets the value of the "_id" fields of each table after the 
insert, and inserts those 2 values into the a_b table? 



   Do I need a primary key field in the a_b table? If so, would it be a 
combination of the (2) _id fields already present in that table. 

    If so, how do I specify that? 



I will probably have other questions after I get these resolved, but having 
these answered would be a great help to me to get started. 



Thank you in advance to anyone wishing to respond. 



-Chris 
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to