当前位置:Gxlcms > mysql > ORA-00957:重复的列名_MySQL

ORA-00957:重复的列名_MySQL

时间:2021-07-01 10:21:17 帮助过:89人阅读

1、错误描述

ORA-00957: 重复的列名

2、错误原因
SQL> create table info(
  2     stu_id varchar2(7) not null, 
  3     stu_name varchar2(20) not null,
  4     stu_age varchar(2) not null,
  5     stu_age number(2) not null,
  6     stu_seat number(2) not null,
  7     enter_date date,
  8     stu_add varchar2(100) default '',
  9     class_no varchar2(4) not null
 10  );
 
create table info(
   stu_id varchar(7) not null,
   stu_name varchar2(20) not null,
   stu_age varchar(2) not null,
   stu_age number(2) not null,
   stu_seat number(2) not null,
   enter_date date,
   stu_add varchar2(100) default '',
   class_no varchar2(4) not null
)
 
创建数据库表时,定义了同名字段stu_age,所以报错

3、解决办法

create table info(
   stu_id varchar(7) not null,
   stu_name varchar2(20) not null,
   stu_age varchar(2) not null,
   stu_seat number(2) not null,
   enter_date date,
   stu_add varchar2(100) default '',
   class_no varchar2(4) not null
)
去掉一个stu_age字段

人气教程排行