6 ms·
The thing that I get annoyed by is when the columns don't match the table names so something like: create table people(person_id int) This literally drives me
by teddyuk 7y ago
The thing that I get annoyed by is when the columns don't match the table names so something like:
create table people(person_id int)
This literally drives me to distraction and I want to throw my computer out of the window :)
- ed_elliott_asc 7y agoThat's really valid I should have included that
- just_myles 7y agoThat is not drastic enough of an example. I can figure out that person is related to people as bad as it sounds.
- ed_elliott_asc 7y agoI don't think there is a drastic example but i've probably worn down my backspace key a bit more than I should have :)
- bsdz 7y agoOne should just use the column name "id" then the table can be renamed if needed without having to rename the columns or perhaps the indexes. Although that's another debate altogether..
- ed_elliott_asc 7y agoI work with ms sql server and use ssdt - with that we can rename columns and tables in the ide and ssdt generates a deployment script that renames the column and table and also all the references pointing to the column or table.
- pmontra 7y agoAccording 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 7y 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 7y 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 7y 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 7y agohow about person_id to person.id?
- combatentropy 7y agoselect * from person join phone on person.id = phone.person
- Kuraj 7y agoYou might still need "person_id" for foreign keys no?
- combatentropy 7y agoselect * from person p join phone ph on p.id = ph.person