MySQL を使用するのはこれが初めてです。MySQL 5.6 Command Line Client を使用してテーブルを表示しようとすると、空のセットが表示されます。実行したいスクリプトステートメントは次のとおりです。
CREATE DATABASE ACMEOnline;
CREATE TABLE ITEM(Item_Number Integer DEFAULT 0, Item_Name Varchar(35) DEFAULT 'No Data', Model_Num Varchar(15) DEFAULT 'No Data',
->Description Varchar(255) DEFAULT 'No Data', Price DOUBLE(8,2) NOT NULL DEFAULT 0.00, Category_Name Varchar(35),
->CONSTRAINT item_item_number_pk PRIMARY KEY(Item_Number),
->CONSTRAINT item_category_name_fk FOREIGN KEY(Category_Name) REFERENCES CATEGORY(Category_Name));
CREATE TABLE CATEGORY(Category_Name Varchar(35), ShippingPerPound DOUBLE(4,2), DiscountsAllowed Char(1),
->CONSTRAINT category_category_name_pk PRIMARY KEY(Category_Name));
CREATE TABLE LINE_ITEM(Quantity TINYINT(2), Shipping_Amount DOUBLE(6,2), OrderID Integer, Item_Number Integer,
->CONSTRAINT line_item_orderid_fk FOREIGN KEY(OrderID) REFERENCES ORDER_ITEM(OrderID),
->CONSTRAINT line_item_item_number_fk FOREIGN KEY(Item_Number) REFERENCES ORDER_ITEM(Item_Number));
CREATE TABLE ORDER_ITEM(OrderID Integer, Item_Number Integer, PRIMARY KEY(OrderID, Item_Number));
CREATE TABLE ORDER(OrderID Integer, Total DOUBLE(10,2), CONSTRAINT order_orderid_pk PRIMARY KEY(OrderID), CustomerID Integer, OfferCode Varchar(15),
->CONSTRAINT customer_offer_customerid_fk FOREIGN KEY(CustomerID) REFERENCES CUSTOMER(CustomerID),
->CONSTRAINT customer_offer_offercode_fk FOREIGN KEY(OfferCode) REFERENCES OFFER(OfferCode));
CREATE TABLE CUSTOMER_OFFER(CustomerID Integer, OfferCode Varchar(15), PRIMARY KEY(CustomerID, OfferCode));
CREATE TABLE OFFER(OfferCode Varchar(15), MinAmount DOUBLE(4,2) NOT NULL, Discount Varchar(35), ExpirationDate Char(8) NOT NULL,
->CONSTRAINT offer_offercode_pk PRIMARY KEY(OfferCode));
CREATE TABLE CUSTOMER(CustomerID Integer, CustomerName Varchar(50), Address Varchar(150), Email Varchar(80),
->CONSTRAINT customer_customerid_pk PRIMARY KEY(CustomerID));
CREATE TABLE BUSINESS(PurchaseTerms Varchar(50), CustomerID Integer, CONSTRAINT business_customerid_pk PRIMARY KEY(CustomerID),
->FOREIGN KEY(CustomerID) REFERENCES CUSTOMER(CustomerID));
CREATE TABLE HOME(CreditCardNum BIGINT(16) NOT NULL, CardExpiration Char(7) NOT NULL, CONSTRAINT home_customerid_pk PRIMARY KEY(CustomerID),
->FOREIGN KEY(CustomerID) REFERENCES CUSTOMER(CustomerID));
CREATE TABLE CONTACT(ContactName Varchar(50), ContactPhone Char(12) NOT NULL, CONSTRAINT contact_contactname_pk PRIMARY KEY(ContactName),
->FOREIGN KEY(Customer ID) REFERENCES BUSINESS(CustomerID));
SHOW TABLES;
DESCRIBE ITEM;
DESCRIBE CATEGORY;
DESCRIBE LINE_ITEM;
DESCRIBLE ORDER_ITEM;
DESCRIBE ORDER;
DESCRIBE CUSTOMER_OFFER;
DESCRIBE OFFER;
DESCRIBE CUSTOMER;
DESCRIBE BUSINESS;
DESCRIBE HOME;
DESCRIBE CONTACT;
MySQL 5.6 コマンド ライン クライアント内:
mysql> use acmeonline;
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> describe item; //the rest of the table names repeated.
ERROR 1146 (42S02): Table 'acmeonline.item' doesn't exist
という名前のデータベースに作成されたアイテムのテーブルがありますが、最後の行が何を意味するのかわかりませんacmeonline
。多分私は何か重要なものを見逃しているのかもしれませんが、何がわかりません。あなたの助けは大歓迎です!