3 ms·
According to my CS professor it's create table person(id int) According to Rails it's create table people(id int) Both agree on how to name the primary
by pmontra 8y ago
According to my CS professor it's
create table person(id int)
According to Rails it's
create table people(id int)
Both agree on how to name the primary key. Person_id would be redundant.
- ed_elliott_asc 8y agoI prefer person and person_id because when joining to to other tables it is easier (in my head) to join person_id to person_id than person_id to id
- Nicksil 8y agoHave you tried creating an alias in your statement(s)? Using `AS` to make this explicit may further help. Just a suggestion.
- ed_elliott_asc 8y agoyes but it is still an akwardness i prefer to avoid by using tablename_id like you'd have to do something like "select id as tablename_id, * from table" just doesn't feel quite right to me personally
- jolmg 8y agohow about person_id to person.id?
- combatentropy 8y agoselect * from person join phone on person.id = phone.person
- Kuraj 8y agoYou might still need "person_id" for foreign keys no?
- combatentropy 8y agoselect * from person p join phone ph on p.id = ph.person