CodeIgniter Forums
how to named table name? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: how to named table name? (/showthread.php?tid=13380)



how to named table name? - El Forum - 11-20-2008

[eluser]sankai[/eluser]
The relationship "One user has many book and one book has one user"
I try create tables as follow:

users
users_books <- error!(Table'testDB.users_books' doesn't exist)
books


users
books_users <- right!
books



so,I try to change the relationship "One user has one book and book has many user" to test.


users
users_books <- error!(Table'testDB.users_books' doesn't exist)
books


users
books_users <- right!
books


it got the same result,why?


how to named table name? - El Forum - 11-20-2008

[eluser]Future Webs[/eluser]
it should not matter how you name your tables.

its your own preference

if you setting up a many to many table the table that joins the other two should just contain the two primary key names

Code:
users
- user_id
- user_name

books
- book_id
- book_name

users_books
- ub_book_id
- ub_user_id



how to named table name? - El Forum - 11-20-2008

[eluser]sankai[/eluser]
[quote author="w3bm" date="1227222062"]it should not matter how you name your tables.

its your own preference

if you setting up a many to many table the table that joins the other two should just contain the two primary key names

Code:
users
- user_id
- user_name

books
- book_id
- book_name

users_books
- ub_book_id
- ub_user_id
[/quote]

I got it!
thand you,w3bm.

:gulp: the topic on incorrect board,again.
sorry to admin!plz,move to the DataMapper board :down: