sqlÖеÄgenderÊôÓÚʲôÊý¾ÝÀàÐÍ
sqlÖеÄÐÔ±ðÊý¾ÝÀàÐÍͨ³£Îª×Ö·ûÀàÐÍ£¬ÏêϸÀàÐÍÒòÊý¾Ý¿âϵͳ¶øÒì¡£³£¼ûµÄÀàÐÍ°üÀ¨¿É±ä³¤×Ö·ûvarchar¡¢¶¨³¤×Ö·ûchar¡¢Ã¶¾ÙÀàÐÍenum¡¢²¼¶ûÀàÐÍtinyint(1)¡£
SQL ÖÐ gender ÊôÓÚºÎÖÖÊý¾ÝÀàÐÍ£¿
ÔÚ SQL ÖУ¬gender ͨ³£ÊôÓÚ×Ö·ûÊý¾ÝÀàÐÍ£¬ÏêϸÀàÐÍ¿ÉÄÜÒò²î±ðµÄÊý¾Ý¿âϵͳ¶øÒì¡£ÒÔÏÂÊÇһЩ×î³£¼ûµÄ gender Êý¾ÝÀàÐÍ£º
VARCHAR(n)£º¿É±ä³¤×Ö·ûÀàÐÍ£¬ÆäÖÐ n Ö¸¶¨×î´ó×Ö·û³¤¶È¡£
CHAR(n)£º¶¨³¤×Ö·ûÀàÐÍ£¬ÆäÖÐ n Ö¸¶¨Àο¿×Ö·û³¤¶È¡£
ENUM£ºÃ¶¾ÙÀàÐÍ£¬ÔÊÐíÓû§Ö¸¶¨Ò»×éÔ¤½ç˵µÄÖµ¡£
TINYINT(1)£º²¼¶ûÀàÐÍ£¬½öÔÊÐí 0 »ò 1 µÄÖµ£¬ÆäÖÐ 0 ÌåÏÖÅ®ÐÔ£¬1 ÌåÏÖÄÐÐÔ¡£
ƾ֤Ìض¨Ãü¾Ý¿âϵͳ£¬gender Êý¾ÝÀàÐÍ¿ÉÄÜ»á½øÒ»²½Ï¸·Ö£¬ÀýÈ磺
MySQL£º
VARCHAR(255)
ENUM(‘male’, ‘female’, ‘other’)
PostgreSQL£º
VARCHAR(10)
CHAR(1)
ENUM(‘M’, ‘F’, ‘O’)
SQL Server£º
VARCHAR(10)
CHAR(1)
TINYINT(1)
ÔÚÑ¡Ôñ gender Êý¾ÝÀàÐÍʱ£¬ÐèҪ˼Á¿Ó¦ÓóÌÐòµÄÐèÇóºÍ´æ´¢ÒªÇ󡣿ɱ䳤×Ö·ûÀàÐÍ VARCHAR ͨ³£ÊÇÊ×Ñ¡£¬ÓÉÓÚ¿ÉÒÔƾ֤ÐèÒª´æ´¢²î±ð³¤¶ÈµÄÖµ¡£Ã¶¾ÙÀàÐÍ ENUM Ò²ºÜÊÇÓÐÓã¬ÓÉÓÚ¿ÉÒÔÏÞÖÆÖµ¹æÄ£²¢È·±£Êý¾ÝÒ»ÖÂÐÔ¡£
ÒÔÉϾÍÊÇsqlÖеÄgenderÊôÓÚʲôÊý¾ÝÀàÐ͵ÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡