[Database] 資料庫內的性別欄位命名,到底應該是 Sex 還是 Gender?

你覺得是 Sex 還是 Gender? 我敢說一定有很高比例的人覺得是 Sex,因為我以前也是這樣,但是到底要用什麼方式來命名,其實還是有些爭議。

你覺得是 Sex 還是 Gender? 我敢說一定有很高比例的人覺得是 Sex,因為我以前也是這樣,但是到底要用什麼方式來命名,其實還是有些爭議。

性別這個欄位,依照一般人的認知,不是男生就是女生,所以大多數人通常會用 0 和 1 (boolean) 或是 M 和 F (char(1)) 的方式存檔,這和兩性議題沒什麼太大關係,純粹就只是識別而已,就字面上意義來看,Sex 是性別的意思,就我個人的解讀,它會比較偏向於只有男女的分別,Gender 是性的意思,但它泛指除了男女以外的性別 (例如雙性人),世界衛生組織的看法是,Sex 比較像是生理上或是實際上的性別,而 Gender 則是社交上的性別,還包含了角色和行為等。

(Ref: http://www.who.int/gender/whatisgender/en/)

其實看到這裡,我想你應該已經有定見了,資料庫內的欄位應該要放 Sex 還是 Gender,基本上兩種都行,不過 Gender 在性別上的解釋會比較廣,Sex 就單純只是男和女的差別,因此只要你覺得 OK,要怎麼取都沒關係。畢竟中間還有程式處理和 View 的呈現,原始資料欄位的命名使用者也不會太關心。

因為 MySQL 自己的手冊中都用 Sex 當欄位名稱了.... http://dev.mysql.com/doc/refman/5.5/en/creating-tables.html

我另外找到了有人針對這個議題分享出來的看法,他大概認為字短點比較好吧 微笑

Should the column name be 'sex'?

First consider Naming Conventions. The word 'sex' is not too long, its characters are all Latin, there is no need to "delimit", using lower case is okay, making it plural ('sexes') would be a mistake, and it's not a reserved word. So far so good.

Next consider the alternative term 'gender'. Some people make a distinction between gender and sex. In that case, 'sex' is better if only a physical characteristic matters, but 'gender' is better if you're also taking into account the behaviour, self-identification, and washroom preference. However, gender's primary dictionary meaning is as a grammatical category, and it is a far less popular word.

Conclusion: yes, the column name should be 'sex'.

不過有趣的是,性別碼是有國際標準的,ISO 5218 定義了性別的四種代碼:

The four codes specified in ISO/IEC 5218 are:

  • 0 = not known,
  • 1 = male,
  • 2 = female,
  • 9 = not applicable.

The standard specifies that its use may be referred to by the designator "SEX".

所以有些欄位會取 CHAR(1) 或是 TINYINT 都可以,其實台灣的身份證就用了 ISO 5218 來定義,男生的身份證第2碼永遠是1,女生則是2。(台灣有0或9開頭的嗎?)

最後來說說我個人的看法,我早期都用 Sex 當欄位名稱,直到幾年前突然想到 Sex 有沒有別的字能替代時,搜尋了一下字典,才看到有 Gender 這個字,之後我也就繼續用了。

總之,要用 Sex 還是 Gender,由你自己決定就好囉 :)