摘要: -定义变量 declare @sum int --变量赋值 set @sum=1 select @sum=3 --变量使用 print @sum declare @string varchar(20) set @string='abcdef' set @string=substring(@strin... 阅读全文
posted @ 2014-12-07 14:25 我是杨波 阅读(457) 评论(0) 推荐(3) 编辑
摘要: --字符串函数.返回字符串最左侧的字母的asii码print ascii('abcde')print ascii(' ')print char(97)--ascii码和字符之间的转换--*charindex查找字符串中对应字符段的开始索引,索引从1开始print charindex('de','ab... 阅读全文
posted @ 2014-12-07 14:23 我是杨波 阅读(767) 评论(0) 推荐(3) 编辑
摘要: create database schoolData go use schoolData go create table Student ( Sno char(3) primary key, Sname char(8) not null, Ssex char(2) not null, Sbirthd... 阅读全文
posted @ 2014-12-01 08:37 我是杨波 阅读(315) 评论(0) 推荐(2) 编辑
摘要: -聚合函数 (1)count(*)求个数 (2)avg(*)求平均数 (3)max(*)求最大值 (4)min(*)求最小值 (5)sum(*)求和 (1)select(select COUNT(*) from student where sex='男'and classcode='20050102... 阅读全文
posted @ 2014-11-27 08:32 我是杨波 阅读(122) 评论(0) 推荐(2) 编辑
摘要: select*from category where Parent='011'or'012'or'013' select*from Category where Parent not in('011','012','013')--parent不是012,013,011的 select*from Ca... 阅读全文
posted @ 2014-11-27 08:30 我是杨波 阅读(112) 评论(0) 推荐(2) 编辑
摘要: 数据库导入导出:导出:右键需要导出的数据库→任务→导出数据→…………导入:右键需要导入到的数据库→任务→导入数据→编辑映射→启用标志插入√→根据需要选择删除原有行或者增添行truncate用法:truncate table score →清空score表中所有数据功能与delete相同,但delet... 阅读全文
posted @ 2014-11-23 15:31 我是杨波 阅读(121) 评论(0) 推荐(2) 编辑
摘要: sql2008一些简单的操作指令create database class--创建数据库use class--选择要操作的数据库 go /*create table student(code int not null, name varchar(10) ,birthday datetime) alt... 阅读全文
posted @ 2014-11-23 15:29 我是杨波 阅读(116) 评论(0) 推荐(2) 编辑
摘要: 今天老师主要大体上讲了SQL server2008的运行和一些工具的使用。SQL是英文Structured(体系,构成,排列) Query(查询)language缩写意思为结构化语言。SQL语言的主要功能就是同各种数据库建立联系进行沟通。按照ANSI(美国国家标准协会)的规定,SQL被作为关系型数... 阅读全文
posted @ 2014-11-20 16:23 我是杨波 阅读(124) 评论(0) 推荐(2) 编辑