永发信息网

为什么这个SELECT语句在SQL 2005中不能执行呢?

答案:3  悬赏:40  手机版
解决时间 2021-03-08 11:42
  • 提问者网友:川水往事
  • 2021-03-07 12:06
create database bbs;
use bbs;
create table article
(
id int primary key auto_increment,
pid int,
rootid int,
title varchar(255),
cont text,
pdate datetime,
isleaf int
);

insert into article values (null, 0, 1, '蚂蚁大战大象', '蚂蚁大战大象', now(), 1);
insert into article values (null, 1, 1, '大象被打趴下了', '大象被打趴下了',now(), 1);
insert into article values (null, 2, 1, '蚂蚁也不好过','蚂蚁也不好过', now(), 0);
insert into article values (null, 2, 1, '瞎说', '瞎说', now(), 1);
insert into article values (null, 4, 1, '没有瞎说', '没有瞎说', now(), 0);
insert into article values (null, 1, 1, '怎么可能', '怎么可能', now(), 1);
insert into article values (null, 6, 1, '怎么没有可能', '怎么没有可能', now(), 0);
insert into article values (null, 6, 1, '可能性是很大的', '可能性是很大的', now(), 0);
insert into article values (null, 2, 1, '大象进医院了', '大象进医院了', now(), 1);
insert into article values (null, 9, 1, '护士是蚂蚁', '护士是蚂蚁', now(), 0);
最佳答案
  • 五星知识达人网友:骨子里都是戏
  • 2021-03-07 12:56
create database bbs;
use bbs;
create table article
(
id int primary key identity(1,1),
pid int,
rootid int,
title varchar(255),
cont text,
pdate datetime,
isleaf int
);

insert into article values (0, 1, '蚂蚁大战大象', '蚂蚁大战大象', getdate(), 1);
insert into article values (1, 1, '大象被打趴下了', '大象被打趴下了',getdate(), 1);
insert into article values (2, 1, '蚂蚁也不好过','蚂蚁也不好过', getdate(), 0);
insert into article values (2, 1, '瞎说', '瞎说', getdate(), 1);
insert into article values (4, 1, '没有瞎说', '没有瞎说', getdate(), 0);
insert into article values (1, 1, '怎么可能', '怎么可能', getdate(), 1);
insert into article values (6, 1, '怎么没有可能', '怎么没有可能', getdate(), 0);
insert into article values (6, 1, '可能性是很大的', '可能性是很大的', getdate(), 0);
insert into article values (2, 1, '大象进医院了', '大象进医院了', getdate(), 1);
insert into article values (9, 1, '护士是蚂蚁', '护士是蚂蚁', getdate(), 0);

用这个语句,你写的那个应该是mysql的语法吧
全部回答
  • 1楼网友:独钓一江月
  • 2021-03-07 14:58
你可能没有跳转到有puts这个表的数据库吧!你确定有这个表,先用: sql>use " 你要跳转到的数据库" sql>select * from puts;
  • 2楼网友:鸽屿
  • 2021-03-07 14:20
id int primary key auto_increment, 这句话不对 不知道你的id要什麼效果,如果是自动产生的序号的话应该是以下写法 id int IDENTITY(1,1) NOT FOR REPLICATION NOT NULL, 并且在insert 的时候是不可以对这个栏位进行新增的.
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯