通过SQL命令行创建表,标识符无效 [英] Creating table via SQL Command Line, invalid identifier
问题描述
我当前正在学习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)
);
真的很感谢您的快速回复!
Really Appreciate the fast replies!
克里斯
推荐答案
您输入的是 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
?)
这篇关于通过SQL命令行创建表,标识符无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!