zoukankan      html  css  js  c++  java
  • 创建数据库表

    选中数据库,可编程性,类型,用户自定义数据类型,增加

    删除

    use test 
    go
    exec sp_addtype phonecall, 'char(11)','not null'
    go
    
    use test
    go
    exec sp_droptype 'phonecall'
    go
    View Code
    alter table student2 --with nocheck
     add 
    constraint pk_student2 primary key --nonclustered 
    (number,name)
    exec sp_help aa
    exec sp_help
    View Code
    create table stu(name int not null)
    sp_help stu
    
    alter table stu
     add briday smalldatetime null
    
     alter table stu
      alter column briday datetime
    
      alter table stu
      drop column briday
    
      sp_rename 'stu.briday','出生日期1'--,'column'
    
      drop table stu
    View Code
    create table stu(
    id int not null identity(1,1) primary key,
    name nvarchar(20) null,
    briday datetime null
    )
    
    --drop table stu 
    sp_help stu
    
    declare @i int;
    set @i=1;
    while @i<=20
    begin 
     insert stu(name,briday) values('aa'+cast(@i as varchar(10)),getdate()); --convert(varchar(10),@i)
     set @i=@i+1;
    end
    View Code

     select top 10 percent  *  from 

    distinct  , in, between and ,  is null

    select * from student where name like '[王李】_'

    select  * into student from stu    --创建表并插入数据

    sum avg max min count

    select 学号,avg(成绩) as '平均分' from student group by 学号 having avg(成绩)>=90

    select 学号 from student where 成绩>=90 group by 学号 having count(*)>3

    inner join 或join  a,b where  ;      left outer join 或 left join  ; right outer join 或 right join ; full join ; cross join 没有条件,没有where; student a join student b on a.姓名=b.姓名 ;

    delete from ksmd  以物理方式一次删除一行,并在事务日志中记录每个删除的行

    truncate table lqxx 通过释放存储表数据所用的数据也来删除,并只在事务日志记录页的释放

  • 相关阅读:
    【前端】常用总结(二)
    【Golang】爬虫笔记
    ubuntu16.04安装SSH服务
    windows下配置pytorch环境
    使用VNC连接ubuntu16.4错误Authentication Failure问题
    window使用VNC远程ubuntu16.04
    ubuntu16.04安装nvidia显卡驱动
    python批量读取并显示图片,处理异常。
    将nii文件CT图像更改窗宽窗位之后保存成nii文件
    yaml.load与yaml.dump的用法
  • 原文地址:https://www.cnblogs.com/futengsheng/p/7897401.html
Copyright © 2011-2022 走看看