▲ 1653 ▼ I love it when I have to scream at a computer (lemmy.world) submitted 2 years ago by tsuica@lemmy.world to c/programmerhumor@lemmy.ml 167 comments fedilink hide all child comments
[–] eek2121@lemmy.world 7 points 2 years ago (1 child) Singular table names? You savage… permalink fedilink source parent hideshow 2 child comments replies: [–] xmunk@sh.itjust.works 13 points 2 years ago (2 children) It's an English literacy thing - we have several non-native English speakers and using only singular avoids making those folks' lives harder. Besides it's really nice to autopilot that categoryid is a foreign key to the category table. It also simplifies always plural words... I haven't yet written CREATE TABLE pants but if I ever do there's zero chance of me creating a pantid. permalink fedilink source parent hideshow 4 child comments replies: [–] eek2121@lemmy.world 10 points 2 years ago (1 child) no underscores either? What are we, apes? permalink fedilink source parent hideshow 2 child comments replies: [–] xmunk@sh.itjust.works 4 points 2 years ago I tend to use underscores on join tables so table foo_bar would have a fooid and a barid. I have somewhat soured on this approach though since there are a lot of situations where you'll have two m-m relationships between the same two tables with a different meaning... and having a fixed formula for m-m tables can make things ugly. If I get to design another greenfield database I'll probably prefer using underscores for word boundaries in long table names. permalink fedilink source parent [–] Faresh@lemmy.ml 3 points 2 years ago (1 child) I always thought they should be singular to be closer to the names we give entities and relations in a entity-relation diagram. permalink fedilink source parent hideshow 2 child comments replies: [–] xmunk@sh.itjust.works 2 points 2 years ago That too, singular table names just makes a lot of stuff more automatic. permalink fedilink source parent
[–] xmunk@sh.itjust.works 13 points 2 years ago (2 children) It's an English literacy thing - we have several non-native English speakers and using only singular avoids making those folks' lives harder. Besides it's really nice to autopilot that categoryid is a foreign key to the category table. It also simplifies always plural words... I haven't yet written CREATE TABLE pants but if I ever do there's zero chance of me creating a pantid. permalink fedilink source parent hideshow 4 child comments replies: [–] eek2121@lemmy.world 10 points 2 years ago (1 child) no underscores either? What are we, apes? permalink fedilink source parent hideshow 2 child comments replies: [–] xmunk@sh.itjust.works 4 points 2 years ago I tend to use underscores on join tables so table foo_bar would have a fooid and a barid. I have somewhat soured on this approach though since there are a lot of situations where you'll have two m-m relationships between the same two tables with a different meaning... and having a fixed formula for m-m tables can make things ugly. If I get to design another greenfield database I'll probably prefer using underscores for word boundaries in long table names. permalink fedilink source parent [–] Faresh@lemmy.ml 3 points 2 years ago (1 child) I always thought they should be singular to be closer to the names we give entities and relations in a entity-relation diagram. permalink fedilink source parent hideshow 2 child comments replies: [–] xmunk@sh.itjust.works 2 points 2 years ago That too, singular table names just makes a lot of stuff more automatic. permalink fedilink source parent
[–] eek2121@lemmy.world 10 points 2 years ago (1 child) no underscores either? What are we, apes? permalink fedilink source parent hideshow 2 child comments replies: [–] xmunk@sh.itjust.works 4 points 2 years ago I tend to use underscores on join tables so table foo_bar would have a fooid and a barid. I have somewhat soured on this approach though since there are a lot of situations where you'll have two m-m relationships between the same two tables with a different meaning... and having a fixed formula for m-m tables can make things ugly. If I get to design another greenfield database I'll probably prefer using underscores for word boundaries in long table names. permalink fedilink source parent
[–] xmunk@sh.itjust.works 4 points 2 years ago I tend to use underscores on join tables so table foo_bar would have a fooid and a barid. I have somewhat soured on this approach though since there are a lot of situations where you'll have two m-m relationships between the same two tables with a different meaning... and having a fixed formula for m-m tables can make things ugly. If I get to design another greenfield database I'll probably prefer using underscores for word boundaries in long table names. permalink fedilink source parent
[–] Faresh@lemmy.ml 3 points 2 years ago (1 child) I always thought they should be singular to be closer to the names we give entities and relations in a entity-relation diagram. permalink fedilink source parent hideshow 2 child comments replies: [–] xmunk@sh.itjust.works 2 points 2 years ago That too, singular table names just makes a lot of stuff more automatic. permalink fedilink source parent
[–] xmunk@sh.itjust.works 2 points 2 years ago That too, singular table names just makes a lot of stuff more automatic. permalink fedilink source parent