码迷,mamicode.com
首页 > 其他好文 > 详细

范式理论, 查询 删除 修改语句, 各种运算符

时间:2014-11-23 15:49:26      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:des   ar   sp   文件   数据   bs   ad   as   数据库   

范式一:
 每一列数据单一

    二:
 尽力与主键直接相关

    三:
 主键尽量体现表中内容

 
    删除系列
 
 truncate table score → 全部清空表里面一丝不剩不会产生日志文件
 
 drop database 数据库名 → 删除数据库;
 
 delete from 表名 → 删除表内数据且保留标的格式;
 
 drop table 表名 → 删除整个表;
 
 delete from 表名 where 列名=‘ ’→ 删除符合单引号里面信息的那一行;
 
 alter table 表名 drop column 列名 → 修改表删除列;
 
 
 
         修改系列
 
 alter table 表名 add 列名 数据类型 → 修改表添加列;
 
 update 表名 set 列名=‘ ‘ → 修改这一列全部的数据;
 
 update 表名 set 列名=‘ ’ where 列名=‘ ’→ 修改满足后面单引号条件的那一行;
 
 update 表名 set 列名 = XX where 列明 between 80 and 100 → 80到100之间的范围性修改
 
 
 
          插入数据
 
 insert into 表名 values() → 插入表的数据
 
 insert into 表名 (列名,列名) values( ,‘ ‘) → 插入前面两列的数据;

 

 

    查询语句
 
 select *from 表名 → 查询表里的数据
 
 select 列明,列明 from 表名 → 查询两列数据
 
 select 列明,列明 from 表名 where 列明=‘要查的名字’→ 按条件查询数据,前面两列
 
 selere *from 表名 where 列名=‘条件’ and 列名 =条件 → 条件查询
 
 selecr *from 表名 where 列明 between 80 and 100 → 范围型查询
 
 select distinct 列名 from 表名 → 针对一列去重显示
 
 select *from 表名 where 列名 like ‘%宏‘ → 模糊查询 通配符%表示任意很多字符:
 
 select *from 表名 where 列名 like ‘_宏‘ →      下划线表示任意一个字符:
 
 selrcr *from 表名 order by 列名 asc → 查询 asc 是升序
 
 selrcr *from 表名 order by 列名 desc → 查询 desc 是降序
 
 select top 3 *from 表名 order by 列名 desc → 查询 降序的前三名
 
 select top 3 *from 表名 order by 列名 asc → 查询 升序的前三名


 逻辑运算符: or=或者    and=并且  
 数学运算符:  +-*/%   
 赋值运算符:  =
 比较运算符: > , < ,<= ,>= ,!= ,=

范式理论, 查询 删除 修改语句, 各种运算符

标签:des   ar   sp   文件   数据   bs   ad   as   数据库   

原文地址:http://www.cnblogs.com/2041388565m/p/4116579.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!