开发者

foo.foo: Is giving a table column the same name as the table itself a bad idea?

开发者 https://www.devze.com 2023-03-15 13:31 出处:网络
I have a very simple table called genre, which looks like this: GENRE ===== id int genre_category varchar()

I have a very simple table called genre, which looks like this:

GENRE
=====
id int
genre_category varchar()

genre_category has values like "narrative", "myth", and so on.

genre_ca开发者_C百科tegory seems like a silly name for the column. The column could be called genre_type or genre_label or genre_category. But it seems redundant.

So, is there any reason not to just go ahead and call it genre.genre?

EDIT:

The bottom line is that it's better to use .name. Thanks everyone!


It sounds like you're modeling a genre entity. Examples horror, drama, romance. Is this correct?

Would you be comfortable in calling your genre's column [name]?


This column should be called 'Name' as this is Genre name.


Why not name the column "category"? Giving your "genre" table a "genre" column seems to say that your genre has a genre, which makes no sense. Rather, a genre has a name or type or category or whatever, so you should name it accordingly.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号