create table divorced_females
select cust_id, cust_first_name,cust_last_name, cust_gender, cust_marital_status from customers
where cust_gender = 'F' and cust_marital_status = 'divorced';
我收到如下错误:
从第1行开始的错误-
创建表divorced_females
从客户中选择cust_id,cust_first_name,cust_last_name,cust_gender和cust_marital_status
其中cust_gender ='F'和cust_marital_status ='离婚'错误报告
ORA-00922:选项丢失或无效
00922. 00000-“选项缺失或无效”
*原因:
*操作:
谢谢。
答案 0 :(得分:2)
您在表名后缺少'AS'。
尝试以下声明:
create table divorced_females as
select cust_id, cust_first_name,cust_last_name, cust_gender, cust_marital_status
from customers
where cust_gender = 'F' and cust_marital_status = 'divorced';
答案 1 :(得分:0)
CREATE TABLE AS语句复制所选列的语法为:
CREATE TABLE new_table
AS (SELECT column_1, column2, ... column_n
FROM old_table);
因此,在您的情况下查询将为
create table divorced_females AS
(select cust_id, cust_first_name,cust_last_name, cust_gender, cust_marital_status
from customers
where cust_gender = 'F' and cust_marital_status = 'divorced');