gaojinguan 发表于 2018-10-19 08:58:59

T-SQL数据库约束学习笔记

create database test  go
  create table table1
  (
  book_ID int primary key not null,
  book_name varchar(50) not null,
  book_from varchar(100) not null
  )
  go
  use test
  select * from table1
  insert into table1 values ('01','数据结构','图书馆一楼')
  go
  alter table table1 add book_infomation varchar(200)
  insert into table1 (book_ID,book_name,book_from) values('02','网络技术','图书馆二楼')
  go
  alter table table1 add constraint DF_table1 default '没有信息' for book_infomation
  insert into table1 (book_ID,book_name,book_from) values('03','西方经济原理','图书馆六楼')
  go
  select * from table1

页: [1]
查看完整版本: T-SQL数据库约束学习笔记