zoukankan      html  css  js  c++  java
  • sql 基本操作

    sql 基本操作

    数据库表的操作
    SQL code
    ------------------------------列操作----------------------------------- --添加列 ALTER TABLE t ADD Mycolumn int identity(1,1)||not null default(0) --删除列 alter table t drop column Mycolumn --修改列 alter table t alter column Mycolumn varchar(20) not null --将表中的数据改为为小数 update t set groups=cast(groups as DECIMAL(10,3)) --将表字段的类型更改小数 alter table t alter column Yourcolumn DECIMAL(10,3)) ------------------------------约束操作---------------------------------- --加约束(默认值) Alter table t Add constraint C_Mycolumn default(30) for Mycolumn --加约束(check条件) alter table dbo.t add constraint ck_t check ('字段'<>'字段') alter table t with nocheck add constraint t_sex check([name] in(N'',N'')) --加约束(主键) alter table t add constraint t_id primary key(id) --删除约束 alter table t drop constraint [DF_t_Mycolumn] --加列加约束(默认值) alter table t add Mycolumn int CONSTRAINT [DF_t_Mycolumn] not null default(0)
  • 相关阅读:
    pku2351 Colored Sticks
    JSOI2010 满汉全席
    享元模式
    适配器模式
    合成模式
    原型模式
    创建型设计模式
    建造者模式
    装饰模式
    单例模式
  • 原文地址:https://www.cnblogs.com/zhangzheny/p/1037736.html
Copyright © 2011-2022 走看看