sql server insert&nbsp…

    xiaoxiao2021-04-18  65

    insert into 表名(字段,字段...) values (value1,value2...)----- delete from 表名 where stuSex = '男' and stuTel like '18%'---删除性别为男且号码是18开头的 update 表名 set stuBirthday = '1996.09.04' where stuName = '张三' 在名字为 张三 处插入生日 select stuName from 表名 where styID = '14046129'-----查询ID为14046129的学生的姓名 ----以下是上课敲的代码------------------------------------------ Alter table information drop FK__informati__stuID__0EA330E9 Alter table Student --删除了身为主键的约束和身为外键的约束 drop PK__Student__AEC9BFAF7F60ED59 Alter table Student --删除了主键 drop column stuID Alter table Student add  StuID char(8) primary key --增加了主键,并且修改了类型 Alter table information alter column StuID char(8) --修改字段类型 Alter table information add constraint fk_stuID_student --增加约束外键()关联到() foreign key(stuID) references Student(stuID)  insert into Student (StuID,stuName,stuSex,stuTel,stuPosition) --插入指定字段的指定值 values ('14046015','赵建波','男','18383930457','班长'), ('14040023','吴华敏','女','15272638495','宣传委员'), ('14046129','郭浩','男','18283933002','部门主管') delete from student where stuSex ='男' and stuTel like '18%' --删除男生,且号码是18 开头的 select * from student --查询表student select * from student where stuTel like '15%' --查询号码是15开头的 select stuName from student where stuTel like ('18%') --查询号码是18开头的人名是什么 关于 update 参考------> update
    转载请注明原文地址: https://ju.6miu.com/read-675042.html

    最新回复(0)