上一页 1 ··· 5 6 7 8 9

2014年12月15日

摘要: 约束主键约束防止在新增数据时出错,有约束性,起唯一标志的作用,在新增条目的时候防止不慎添加重复内容(不允许有null值)1、 右键—设计—设置主键2、在创建表格时设置code int primary key,3、可以设置自增长的功能 code int primary key identity(1,1... 阅读全文
posted @ 2014-12-15 15:40 leaves0529 阅读(162) 评论(0) 推荐(2) 编辑
 
摘要: 子查询(用来进行两个或以上表之间的查询)1、首先新建一个bumen表和一个haha表,填充数据2、利用两表进行子查询:--部门人数大于5的部门中最大年龄的人的信息---select bumen as 部门,COUNT(*)as 人数 from haha group by bumen having C... 阅读全文
posted @ 2014-12-15 15:39 leaves0529 阅读(416) 评论(4) 推荐(2) 编辑
 
摘要: 日期时间数据类型*系统常量:@@DATEFIRST(返回当前时间)DATEADD增加时间语法:DATEADD (datepart , number , date )select DATEADD(YEAR,2,'2013-11-2')DATEDIFF两个日期之间的距离select DATEDIFF(Y... 阅读全文
posted @ 2014-12-15 15:37 leaves0529 阅读(435) 评论(0) 推荐(3) 编辑
 
摘要: 字符串函数ASCII返回字符串首字母的ascii编码select ASCII('name')select ASCII(name) from xueshengselect *from xuesheng where ASCII(name)>=200CHAR--将ascii代码转换成对应的字符select... 阅读全文
posted @ 2014-12-15 15:34 leaves0529 阅读(169) 评论(0) 推荐(2) 编辑
 
摘要: 规范函数:绝对值select abs(-5)print abs(-5)表中取绝对值的方法:select code,name,abs(chinese)as yuwen from xueshengselect *from xuesheng where ABS(chinese)>90天花板、地板selec... 阅读全文
posted @ 2014-12-15 15:32 leaves0529 阅读(196) 评论(0) 推荐(2) 编辑
 
摘要: 分组group byselect class from xuesheng group by classselect class,AVG(chinese)from xuesheng group by classselect math from xuesheng where math >80 group... 阅读全文
posted @ 2014-12-15 15:31 leaves0529 阅读(217) 评论(0) 推荐(2) 编辑
 
摘要: 聚合函数--求平均select AVG(age) as 年龄 from xueshengselect AVG(chinese) as 语文 from xuesheng where class = 1*只能对数字类型的进行操作--求个数select COUNT(*) from xuesheng/*查询... 阅读全文
posted @ 2014-12-15 15:27 leaves0529 阅读(251) 评论(0) 推荐(2) 编辑
 
摘要: 分离、附加、备份、还原--去重select distinct 列名from表名--更新update fenshu set name = ‘李四’where code = 9--更改表名sp_rename 表名drop database 数据库名(删除数据库)drop table 表名Delete f... 阅读全文
posted @ 2014-12-15 15:20 leaves0529 阅读(198) 评论(0) 推荐(2) 编辑

2014年11月8日

摘要: 二进制转换为十进制(展权相加法)110101 =1*2^5+1*2^4+0*2^3+1*2^2+0*2^1+1*2^01、 写22、 标指数(从右到左)3、 乘系数(一一对应)4、 相加十进制转二进制(除权取余)除2到商零为止,从下到上取余数简单法:……8421十六进制的表达0123456789AB... 阅读全文
posted @ 2014-11-08 16:51 leaves0529 阅读(278) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9