CodeIgniter Forums
Database relationships - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Database relationships (/thread-68903.html)



Database relationships - lupacexi - 09-12-2017

Hi,

When using one of the following relationships between models ;
  • one to one

  • many to one

  • one to many
If I would like my query to return all records including the relations is this statement true or false?

Statement:
All three types use a single JOIN clause to return all records including the relations


RE: Database relationships - dave friend - 09-12-2017

If, in the context of databases, by "relationship" you mean a situation that exists between two database tables when one table has a foreign key that references the primary key of the other table, then the statement is true. Though it might be more accurate to say that "All three types use at least one JOIN clause to return all records". The possibility exists that more than one JOIN was utilized.

I am not sure what you mean by "including the relations" in the return.


RE: Database relationships - kilishan - 09-12-2017

This is the second time I've seen this question come up. Is this for a test or something?


RE: Database relationships - InsiteFX - 09-13-2017

Each one is a separate entity.