Oracle - 创建 TABLE 时出现错误 "missing left parenthesis"
Oracle - Error "missing left parenthesis" when CREATE TABLE
我正在使用 Oracle SQL Developer 来学习和实施 SQL 查询。但每次我尝试创建 Table 时,它都会出错,我不确定我到底遗漏了什么。看图看错误:
编辑:
Table 应该有一个专栏。
创建 table table_name(column_name 数据类型);
您必须定义列:
CREATE TABLE table2(col_name NUMBER);
It is not I dunno about adding columns in a table. I don't know why it is showing me "missing left parenthesis in line 1"?
所以让我们查看CREATE TABLE的官方文档:
Each of the clauses following the table name is optional for any given relational table. However, for every table you must at least specify either column names and datatypes using the relational_properties clause or an AS subquery clause using the table_properties clause.
如您所见,关系属性必须使用 (
和 )
。
编辑:
See this image even with column as you said
现在你有不同的错误:invalid identifier
。您必须删除 ,
:
CREATE TABLE table(
ID NUMBER(2) --, causes error
);
来自文档:
如您所见,如果没有其他列定义,就不能有 ,
。
也许您在不同的 RDBMS 中看到过这种模式,例如 SQL Server
:
CREATE TABLE tab
(
a INT, -- yes it works and could be very handy when editing
);
不能在列定义后使用逗号。如果有多个列,则可以使用它们,但只有一列时则不能。看下面的例子——
Create Table A (
i int,
j int
);
对于一列 -
Create Table A (
i int
);
我正在使用 Oracle SQL Developer 来学习和实施 SQL 查询。但每次我尝试创建 Table 时,它都会出错,我不确定我到底遗漏了什么。看图看错误:
编辑:
Table 应该有一个专栏。
创建 table table_name(column_name 数据类型);
您必须定义列:
CREATE TABLE table2(col_name NUMBER);
It is not I dunno about adding columns in a table. I don't know why it is showing me "missing left parenthesis in line 1"?
所以让我们查看CREATE TABLE的官方文档:
Each of the clauses following the table name is optional for any given relational table. However, for every table you must at least specify either column names and datatypes using the relational_properties clause or an AS subquery clause using the table_properties clause.
如您所见,关系属性必须使用 (
和 )
。
编辑:
See this image even with column as you said
现在你有不同的错误:invalid identifier
。您必须删除 ,
:
CREATE TABLE table(
ID NUMBER(2) --, causes error
);
来自文档:
如您所见,如果没有其他列定义,就不能有 ,
。
也许您在不同的 RDBMS 中看到过这种模式,例如 SQL Server
:
CREATE TABLE tab
(
a INT, -- yes it works and could be very handy when editing
);
不能在列定义后使用逗号。如果有多个列,则可以使用它们,但只有一列时则不能。看下面的例子——
Create Table A (
i int,
j int
);
对于一列 -
Create Table A (
i int
);