网站首页  汉语字词  英语词汇  考试资料  写作素材  旧版资料

请输入您要查询的考试资料:

 

标题 工作和学习中经常用到的sql语句
内容
    一些常用地sql语句:
    新建表:
    create table [表名]
    (
    [自动编号字段] int identity (1,1) primary key ,
    [字段1] nvarchar(50) default '默认值' null ,
    [字段2] ntext null ,
    [字段3] datetime,
    [字段4] money null ,
    [字段5] int default 0,
    [字段6] decimal (12,4) default 0,
    [字段7] image null ,
    )
    新建表:
    create table [表名]
    (
    [自动编号字段] int identity (1,1) primary key ,
    [字段1] nvarchar(50) default '默认值' null ,
    [字段2] ntext null ,
    [字段3] datetime,
    [字段4] money null ,
    [字段5] int default 0,
    [字段6] decimal (12,4) default 0,
    [字段7] image null ,
    )
    删除表:
    drop table [表名]
    插入数据:
    insert into [表名] (字段1,字段2) values (100,'51windows.net')
    删除数据:
    delete from [表名] where [字段名]>100
    更新数据:
    update [表名] set [字段1] = 200,[字段2] = '51windows.net' where [字段三] = 'haiwa'
    新增字段:
    alter table [表名] add [字段名] nvarchar (50) null
    删除字段:
    alter table [表名] drop column [字段名]
    修改字段:
    alter table [表名] alter column [字段名] nvarchar (50) null
    重命名表:(access 重命名表,请参考文章:在access数据库中重命名表)
    sp_rename '表名', '新表名', 'object'
    新建约束:
    alter table [表名] add constraint 约束名 check ([约束字段] <= '2000-1-1')
    删除约束:
    alter table [表名] drop constraint 约束名
    新建默认值
    alter table [表名] add constraint 默认值名 default '51windows.net' for [字段名]
    删除默认值
    alter table [表名] drop constraint 默认值名
    :
随便看

 

在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。

 

Copyright © 2002-2024 cuapp.net All Rights Reserved
更新时间:2025/5/17 16:33:30