mysql:12900
From: "honma" <"honma" <honma@xxxxxxxxxx>>
Date: Sat, 1 Apr 2006 09:54:42 +0900
Subject: [mysql 12900] データベースのフィールド名について
いつも拝見させていただきありがとうございます。 ちょっと、変な質問で申し訳ありませんが教えてください。 フィールド名についてなんですが、今の私のつけ方に疑問 を感じまして投稿させていただきます。 環境はOS XP-Pro MySql4.1.13 PHP5 Apache1.3です。 以下のような感じでテーブルを作成しました。 ここで疑問ですがidはすべてidにしたのですが、それぞれ 違う名前のほうがいいのでしょうか? たとえば、csm_id ko_id syain_idなどです。 そうした場合、他のフィールドもすべてユニークなほうが 使いやすいのでしょうか? たとえば csm_name ko_name syain_name などです。 初歩的な質問で申し訳ありませんがよろしくお願いします。 #customer $query = "CREATE TABLE " . TABLE_NAME_KOKYAKU . "(" . "id INT NOT NULL UNIQUE PRIMARY KEY," . "name VARCHAR(20)," . "kana VARCHAR(20)," . "keisho VARCHAR(6)," . "birthday DATE," . "ox VARCHAR(4)," . "yubin VARCHAR(20)," . "jusho1 VARCHAR(64)," . "jusho2 VARCHAR(64)," . "tel VARCHAR(20)," . "fax VARCHAR(20)," . "keitai VARCHAR(20)," . "mail VARCHAR(45)," . "shokushu INT(2)," . "group_id INT," . "bikou VARCHAR(256)," . "shoukyo INT(1) Default 0," . "modify DATETIME)"; $result = mysql_query($query , $db); #子 $query = "CREATE TABLE " . TABLE_NAME_KO . "(" . "id INT NOT NULL UNIQUE AUTO_INCREMENT PRIMARY KEY," . "name VARCHAR(32)," . "kana VARCHAR(32)," . "birthday DATE," . "ox VARCHAR(4)," . "csm_id INT," . "bikou VARCHAR(128)," . "shoukyo INT(1) Default 0," . "modify DATETIME)"; $result = mysql_query($query , $db); #販売履歴 $query = "CREATE TABLE " . TABLE_NAME_HANBAI . "(" . "id INT NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY," . "order_date DATE," . "csm_id INT," . "ko_id INT," . "shohin_id INT," . "shiire_tanka INT," . "syanai_tanka INT," . "hanbai_tanka INT," . "denpyo_no INT," . "nouhin DATE," . "shoukyo INT(1) Default 0," . "modify DATETIME)"; $result = mysql_query($query , $db); #フォロー履歴 $query = "CREATE TABLE " . TABLE_NAME_FOLLOW . "(" . "id INT NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY," . "follow_date DATE," . "csm_id INT," . "tanto_id INT," . "shubetsu_id INT," . "naiyou VARCHAR(200)," . "bikou VARCHAR(32)," . "shoukyo INT(1) Default 0," . "modify DATETIME)"; $result = mysql_query($query , $db); #フォロー種別 $query = "CREATE TABLE " . TABLE_NAME_FOLLOW_SHUBETSU . "(" . "id INT NOT NULL UNIQUE PRIMARY KEY," . "name VARCHAR(50)," . "hosoku VARCHAR(20)," . "bikou VARCHAR(50)," . "shoukyo INT(1) Default 0," . "modify DATETIME)"; $result = mysql_query($query , $db); 以下省略-----
-> 12900 2006-04-01 09:54 ["honma" <honma@xxxxx] データベースのフィールド名について 12907 2006-04-03 12:03 ┗["Kenta Hashimoto" <k] 12911 2006-04-04 06:07 ┗["honma" <honma@xxxxx]