SQL server中关于插入子查询的结果
我有三张表,用户表:
create table users(
userId int primary key identity(1,1) ,
username varchar(20) unique notnull,
password varchar(20) not null,
email varchar(30),
powers varchar(20) not null,
sex varchar(20) ,
address varchar(40) not null,
integration varchar(40) not null,
account Numeric(10,2),
present varchar(20)
)
create table present(
pid int primary key identity(1,1),
pname varchar(20) unique not null,
pjf Numeric(10,2),
pphoto varchar(20)
)
create table redeem(
rid int primary key identity(1,1),
userid int,
pid int,
rdate Datetime default(getdate()),
rcl varchar(20),
foreign key (userid) references Users(userid),
foreign key (pid) references present(pid)
)