当前位置:Gxlcms > 数据库问题 > 数据库笔记

数据库笔记

时间:2021-07-01 10:21:17 帮助过:29人阅读

    alter table StudentInfo
    add constraint CK_ CIdd check(CId>=0 and CIdd<=120)

7---增加外键约束

   alter table StudentInfo
   add constraint Fk_dept foreign key(CId) references ClassInfo (CId)

8--删除约束
    alter table StudentInfo

    drop  constraint  约束名

9.-----删除数据指定的数据

    delete from grades
    where Stu_name=‘王博‘

10---删除某一列

   alter table grades
   drop column address

11----更新表grade的数据
      update grades
     set grade=100 where Class_id=12

12----TOP 子句用于规定要返回的记录的数目。

   SELECT TOP 2 Stu_age     //返回这一列的前2行
   from Student

     SELECT TOP 2                      //返回改表的前2行
      *from Student
13-----选取50%的记录
    select top 50 percent *from Student12       //返回改表的前半行
    select *from Student12

 

数据库笔记

标签:delete   percent   外键约束   bsp   tin   这一   默认   tab   span   

人气教程排行