通过 SQL 命令行创建表,标识符无效
我目前正在学习 SQL,并且我已经在我的系统上安装了 oracle 11g express.我正在尝试创建一个表,但是当我尝试运行以下命令时,我收到以下错误消息:
I'm currently learning SQL and I've installed oracle 11g express on my system. I'm trying to create a table however when I try to run the below command I get the following Error Message:
第 3 行的错误:ORA-00904 : 无效标识符
ERROR at line 3: ORA-00904 : invalid identifier
CREATE TABLE PROJECTS (
proID NUMBER(4) NOT NULL,
Desc CHAR(20),
sDate DATE,
eDate DATE,
Budget NUMBER(7,2),
maxStaff NUMBER(2)
);
谁能告诉我我做错了什么?
Can anybody please tell me what I'm doing wrong?
感谢大家的回复,我成功运行了这个命令:
Thanks for all the replies, I ran this command succesfully:
CREATE TABLE PROJECTS (
proID NUMBER(4) NOT NULL,
description CHAR(20),
sDate DATE,
eDate DATE,
Budget NUMBER(7,2),
maxStaff NUMBER(2)
);
真的很感谢快速回复!
克里斯
推荐答案
您将 DESC
作为列名.虽然您可以使用它,但您必须将其括在引号中:
You have DESC
in as a column name. While you can use it you will have to encompass it in quotes:
CREATE TABLE PROJECTS (
proID NUMBER(4) NOT NULL,
"Desc" CHAR(20),
sDate DATE,
eDate DATE,
Budget NUMBER(7,2),
maxStaff NUMBER(2)
);
每次在查询中调用它时都必须使用引号.我建议将该列更改为其他内容(也许是 DESCRIPTION
?)
You will also have to use quotes every time you call it in a query. I recommend just changing that column to something else (maybe DESCRIPTION
?)
相关文章