MySQL:使用连接创建视图 - 语法错误

时间:2017-02-23 20:13:23

标签: mysql view concatenation

我正在构建一个小型数据库,并且我正在尝试创建一个视图,该视图将一起显示客户的名字和姓氏,并在代码末尾的FROM CUSTOMER处收到语法错误。有什么想法吗?

CREATE TABLE CUSTOMER (
CUST_ID      INT    NOT NULL     AUTO_INCREMENT     UNIQUE,
CUST_LNAME      VARCHAR(25)    NOT NULL,
CUST_FNAME      VARCHAR(25)    NOT NULL,
CUST_STREET_NO   VARCHAR(6),
CUST_STREET_NAME     VARCHAR(25),
CUST_APT_NO     VARCHAR(10),
CUST_CITY     VARCHAR(25),
CUST_STATE     CHAR(2),
CUST_ZIP_CODE     CHAR(5),
PRIMARY KEY (CUST_ID)
)ENGINE = InnoDB;

CREATE VIEW V_Customer AS
SELECT   
CUST_ID,   
CONCAT(CUST_FNAME ," ",CUST_LNAME ) FULL_NAME,
CUST_STREET_NO,
CUST_STREET_NAME,
CUST_APT_NO,
CUST_CITY,
CUST_STATE,
CUST_ZIP_CODE,
FROM CUSTOMER;

0 个答案:

没有答案