首页 > 解决方案 > 在dept表中,出现列错误deptno

问题描述

我不明白为什么,而不是列deptno 上出现的数字#

我是这方面的初学者,我正在阅读一本书“专家 Oracle 数据库架构”,我找到了一个需要创建此表的示例

也许这本书不适合初学者,但我还是开始读了

我使用 Oracle 12 c r2

在此先感谢,彼得

SQL> create table dept 
  2  ( deptno number(2),
  3  dname varchar2(14),
  4  loc varchar2(13), 
  5  last_mod timestamp with time zone 
  6  default systimestamp 
  7  not null, 
  8  constraint dept_pk primary key(deptno)
  9  ) 
 10  ;

Table created.

SQL> insert into DEPT (DEPTNO, DNAME, LOC)
  2  values(10, 'ACCOUNTING', 'NEW YORK')
  3  ;

1 row created.

SQL> insert into DEPT (DEPTNO, DNAME, LOC)
  2  values(20, 'RESEARCH', 'DALLAS');

1 row created.

SQL> insert into DEPT (DEPTNO, DNAME, LOC)
  2  values(30, 'SALES', 'CHICAGO');

1 row created.

SQL> insert into DEPT (DEPTNO, DNAME, LOC)
  2  values(40, 'OPERATIONS', 'BOSTON');

1 row created.

SQL> select * from dept;

    DEPTNO DNAME              LOC       LAST_MOD
---------- ------------------------------ ------------- --------------------------------------------------
########## ACCOUNTING             NEW YORK  28-NOV-18 01.29.06.149308 PM -05:00
########## RESEARCH               DALLAS    28-NOV-18 01.29.20.001800 PM -05:00
########## SALES                  CHICAGO   28-NOV-18 01.29.40.491547 PM -05:00
########## OPERATIONS             BOSTON    28-NOV-18 01.30.10.842314 PM -05:00

标签: sqloracle

解决方案


推荐阅读