(相关资料图)
1、sql语句中假如default设置的是默认值,当不显示插入字段时,可以默认插入设置的默认值. 例如建立学生信息表Student,同时设置学号StudentNo为主键,如下: create table Student( StudentNo int not null primary key, StudentName nvarchar(20) not null ) 也可以先建学生信息表Student,然后为学号StudentNo添加主键。
2、如下: 1.建学生信息表Student create table Student( StudentNo int not null, StudentName nvarchar(20) not null ) 2.为学号StudentNo添加主键 alter table Student //注释:修改学生信息表Student add constraint PK_StudentNo primary key (StudentNo) //注释:为StudentNo添加主键。
本文就为大家分享到这里,希望小伙伴们会喜欢。
关键词:
Copyright 2015-2022 亚太直播网版权所有 备案号:沪ICP备2020036824号-11 联系邮箱: 562 66 29@qq.com