这是我第一次做 MySQL。我正在使用 MySQL 5.6 命令行客户端并尝试显示表格,但它显示为空集。这是我要执行的脚本语句:
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
. 也许我错过了一些重要的东西,但我不知道是什么。您的帮助将不胜感激!