sql2008和sqlyog的区别

sql2008和sqlyog的区别,第1张

区别收费和不收费

QLServer系列软件是Microsoft公司推出的关系型数据库管理系统。2008年10月,SQLServer2008简体中文版在中国正式上市,SQLServer2008版本可以将结构化、半结构化和非结构化文档的数据直接存储到数据库中。

SQLServer2008的数据库中有包含数据库的语义的。

我们做数据时候常用的SQLServer2008数据库一般都是汉化后的中文版,包含的语句语义是比较好理解的,如果下载的是英文版,也可以看,不过不容易找到对应的库。

--select<字段,*> 纵切

--from<数据表>

--where<表达式>横切 注释:对from后的数据表数据的过滤

--group by<字段>注释:select只能使用group by中出现的字段

--having<表达式>

--order by <字段>【Asc,Desc】

--count 计数

--sum 统计

--avg 平均值

--cast 数据类型转换cast<字段>as数据类型描述

--max 最大值

--min 最小值

--value 为空时(null) 给默认值

--syspublic.dual 虚表 注释:在oracle数据库中直接使用dual,不用带模式;在sqlserver中不需要虚表辅助

--别名 as可以省略

select sex,count(*)

from student

group by sex

select distinct sex

from student

select sum(age)

from student

select avg(age)

from student

select avg(cast(age as decimal(18,6)))

from student

select max(age)

from student

select min(age)

from student

select *

from student

where age=(select min(age) from student)

select value(sum(age),0)--value=nvl

from student

where name like '张%'

select age

from student

group by age

having age<30

select age

from student

where age<30

group by age

select * from student

select 'abc'||'def' from syspublic.dual

select cast('12' as varchar(2)) from syspublic.dual

select name as 姓名 from student--as 可以省略

select ID 学号 ,name 姓名, age 年龄 from student

select student.name ,result1.C_ID,result1.score ,result1.S_ID

from student full join result1

on student.id=result1.S_ID

where student.name is null or result1.score is null

--连接语法格式

select <表一字段><表二字段>

from<表一>【left,right,full,inner】join<表二>

on <表达式>

select student.name ,result1.C_ID,result1.score ,result1.S_ID

from student inner join result1

on student.id=result1.S_ID

where student.name is null or result1.score is null

select T1.*,T2.*

from student as T1, result1 as T2

where T1.ID=T2.S_ID

select T1.Id,T1.name

from student T1,result1 T2

where T1.id=T2.s_id

select t1.id,t1.name,(select t2.score from result1 t2 where t2.s_id=t1.id and t2.c_id='C001')

from student t1

where t1.id in(select T3.S_ID from result1 t3 where t3.c_id='C001')

--length 求一个字符串的长度

select length('abcdefg') from syspublic.dual

--substr 求子串

select substr('abcdefg',1,4) from syspublic.dual

--replace 替换

select replace('abcdeffg','ff',66) from syspublic.dual

--year,month,date,day

select year('2011-04-12') from syspublic.dual

select month('2011-04-12') from syspublic.dual

select date('2011-04-12') from syspublic.dual

select day('2011-04-12') from syspublic.dual

--last_day某月的最后一天是几号

select last_day('2011-02-01')from syspublic.dual

--add_months

select add_months('2011-04-11',1)from syspublic.dual

--days取得从公元元年到现在的天数

select days('2011-4-13') from syspublic.dual

select (days('2011-5-13') -days('2011-4-13'))*50 from syspublic.dual

update <表>

set<字段>=<值>

where <表达式>

update result1

set score=100

where s_id='0001' and c_id='C001'

select *

from result1

where s_id='0001' and c_id='C001'

--delete from<表>where <表达式>

connect to test2 user db2admin using db2admin

grant select on P1 to testuser

grant all on P1 to testuser

select * from db2admin.P1


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/9895511.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-03
下一篇 2023-05-03

发表评论

登录后才能评论

评论列表(0条)

保存