| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 668 人关注过本帖
标题:create table 的问题
取消只看楼主 加入收藏
雨蒙珍珍
Rank: 1
等 级:新手上路
威 望:1
帖 子:169
专家分:0
注 册:2006-4-10
收藏
 问题点数:0 回复次数:2 
create table 的问题
最进在学习DDL
在用create table 创建表的时候 没有考虑加主键。当然我知道什么是主键。
我在操作 (1)
create table people
( peopleid integer not null,
people_name varchar(20) not null,
people_email varchar(10) not null,
people_pwd varchar(10) not null,
)

(2)
create table people
( peopleid integer not null,
people_name varchar(20) not null,
people_email varchar(10) not null,
people_pwd varchar(10) not null,
primary key (peopleid) 在这里加入了这句代码
)
(3)提示有错
(4) 然后我这样做的

create table people
( peopleid integer not null,
people_name varchar(20) not null,
people_email varchar(10) not null,
people_pwd varchar(10) not null,
)

alter table people
add primary key (peopleid) 加入这样的代码
(5)主键添加成功
我的问题是在用代码创建数据库的时候如果要修改不能在已经执行的代码中加语句
要用alter语句是吗?
搜索更多相关主题的帖子: table create 
2006-12-26 20:20
雨蒙珍珍
Rank: 1
等 级:新手上路
威 望:1
帖 子:169
专家分:0
注 册:2006-4-10
收藏
得分:0 

这个怎么说 ?请教一下 谢谢!

2006-12-27 09:19
雨蒙珍珍
Rank: 1
等 级:新手上路
威 望:1
帖 子:169
专家分:0
注 册:2006-4-10
收藏
得分:0 
呵呵 我当然知道要是全部都加主键的话  那么这个设计人或许精神不正常!
2006-12-27 16:34
快速回复:create table 的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013523 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved