简体   繁体   中英

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

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_category 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] ?

此列应称为“名称”,因为这是类型名称。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM