SQLServer学习笔记系列12
一.写在前面的话
这个sql学习系列,今天准备告一段落,虽然短短的十几篇文章,深刻感受到将学习的东西记录下来,是需要一种坚持!
这些东西只有反复的学习吸收,最终沉淀下来的才是属于自己的知识。也是提醒自己,今后的日子更要有计划,转眼又是7月份了,
时间不等人,岁月不饶人!坚持自己的计划,坚持向往的东西,踏实学习,因为自己不会的还太多,那些大牛还在学习,
我就更没理由逃避!也希望结交一些朋友,一起讨论技术,一起学习,一起进步!
二.触发器
触发器是一种特殊类型的存储过程,不能被显示的执行。它所监控的是对某一个表的操作,然后对应的执行相应的sql语句。
常见的触发器有三种:分别应用于Insert , Update , Delete 事件。触发器没有参数。 分为:after触发器instead of 触发器。
实例:审核货运公司表,表发生了操作以后,记录日志。用触发器监控。
1.创建日志表,记录对货运公司的操作:
USE TSQLFundamentals2008;
IF OBJECT_ID('shipper_log') IS NOT NULL
DROP TABLE shipper_log;
CREATE TABLE shiiper_log
(
logId INT IDENTITY(,) PRIMARY KEY,
opdate datetime DEFAULT GETDATE(),
opuser nvarchar(),
op nvarchar(),
shipname nvarchar(),
shipphone nvarchar()
)
2.创建审核货运公司的触发器:
CREATE TRIGGER tg_ship
ON sales.shippers AFTER INSERT ,DELETE,UPDATE
as
INSERT INTO dbo.shiiper_log
( opdate ,
opuser ,
op ,
shipname ,
shipphone
)
SELECT GETDATE() , -- opdate - datetime
CURRENT_USER , -- opuser - nvarchar()
N'插入' , -- op - nvarchar()
companyname, -- shipname - nvarchar()
phone -- shipphone - nvarchar()
FROM INSERTED;
3.创建完成触发器以后,我们可以查看一下记录货运公司日志表里面的内容:
SELECT * FROM dbo.shiiper_log;
可以看到数据为空,当我们向货运公司插入一条记录如何了?
INSERT INTO Sales.Shippers
( companyname, phone )
VALUES ( N'Isoftstone', -- companyname - nvarchar()
N'' -- phone - nvarchar()
)
插入以后,我们再查看一下多货运公司操作的记录表:
SELECT * FROM dbo.shiiper_log;
我们看到插入一条记录以后,执行消息里面受影响行数有两条:
我们继续查询下日志表记录:
SELECT * FROM dbo.shiiper_log;
这就实现了对货运公司操作的监控,从日志表里面就可以看到货运公司表里面操作的记录。
三.获取标识问题
标识列有利于相当于一个特殊标记,我们可以根据标识列很容易的去查看数据。
(1)获取系统提供的标识值,整个系统范围内。
INSERT INTO Sales.Shippers
( companyname, phone )
VALUES ( N'Isoftstone', -- companyname - nvarchar()
N'' -- phone - nvarchar()
) --整个系统范围内
SELECT @@IDENTITY;
我们先向货运公司表里面插入一条记录,然后查询系统的标识值,由于货运公司表做了触发器处理,所以插入一条记录时候,同时向货运公司
日志表里面也插入了一条记录。所以我们在查询系统当前的标识值时,查询到的是最新的系统范围内的标识值。
(2)获取当前作用域中最新的的标识值。
--当前作用域内最新的标识值
SELECT SCOPE_IDENTITY();
通过查询货运公司表可以看到当前作用域内最大的标识值为8.
这个学习系列写完,让自己也学会了很多,知道做一件事情坚持下去,才会让自己成长!
脚踏实地,一步一步踏踏实实走下去,相信越努力越幸运!后续会继续学习,
永远相信美好的事情即将发生!希望各位大牛给出指导,不当之处虚心接受学习!谢谢!
这里分享下这个系列所写的sql脚本。
select top * from A where ID
not in(select top ID from A order by ID asc)
order by ID asc select top * fron A where ID>
(select Max(ID) from (select top ID from A order by ID)as t)
order by ID asc select top * from A a1
WHERE NOT EXISTS
(SELECT * from
(SELECT TOP * FROM A ORDER BY id asc) a2
WHERE a2.id =a1.id
) select top() percent * from hr.employees select count(*) as N'总人数' from hr.employees select top with ties orderid,orderdate
from sales.orders order by orderdate desc select firstname,lastname ,count(*) over() as N'总人数'
from hr.employees select orderid,custid,sum(val) over (partition by custid) as N'顾客消费总额',
sum(val) over() as N'订单总额' from sales.ordervalues select country,ntile() over (order by country) as N'ntile分组',dense_rank() over(order by country) as N'dense_rank排名', lastname,firstname
from hr.employees
order by country select lastname,firstname,country,row_number() over( partition by country order by country) as N'排名'
from hr.employees select * from sales.ordervalues
where val>= and val<= select * from sales.ordervalues
where val between and select * from sales.ordervalues
where custid= or custid= or custid= select * from sales.ordervalues
where custid in(,,) select * from Hr.employees
where lastname like '%a%' declare @t char();
set @t='hello';
set @t=isnull(@t,'')+'world';
print datalength(rtrim(@t) select productname,replace(productname,'Product','产品名')
from production.products select productname,stuff(productname,,,'::::')
from production.products select productname,upper(productname),lower(productname)
from production.products declare @s char();
set @s='hello';
select datalength(rtrim(@s));
print len(@s); select firstname,lastname,
case region
when 'WA' then '华盛顿地区'
else '其他地区'
end
from hr.employees select firstname,lastname,region
from hr.employees select firstname,lastname,
case when region ='WA' then '华盛顿地区'
when region is null then '未知地区'
else '其他地区'
end
from hr.employees select * from sales.orders
where orderdate>'' select * from sales.orders
where orderdate>cast('' as datetime) select datepart(year,getdate()) as N'年份',
datepart(month,getdate()) as N'月份',
datepart(day,getdate()) as N'日',
datepart(hour,getdate()) as N'时',
datepart(minute,getdate()) as N'分',
datepart(second,getdate()) as N'秒' select datepart(dayofyear,getdate()) as N'一年中的第几天',
datepart(weekday,getdate()) as N'一星期中第几天',
datepart(week,getdate()) as N'今年的第几周' select dateadd(day,,getdate()) as N'20天后的是什么日子',
datediff(year,'',getdate()) as N'祖国成立这么多年啦',
datediff(year,'',getdate()) as N'屌丝多大啦' select convert(nvarchar,getdate(),) as N'转化后的形式',
left( convert(nvarchar,getdate(),),) as N'取出年月' select orderid,custid,empid from sales.orders select * from hr.employees;
select * from sales.shippers; select a.*,b.*
from hr.employees a cross join sales.shippers b; select * from production.categories
select * from production.products select a.categoryid,a.categoryname,b.productid,b.productname
from production.categories a inner join production.products b
on a.categoryid=b.categoryid; select * from sales.customers
select * from sales.orders select a.custid,b.custid,a.contactname,a.fax,
count(b.orderid) as N'顾客订单数量'
from sales.orders b right join sales.customers a
on a.custid=b.custid
group by a.custid ,a.fax,a.contactname,b.custid
order by count(b.custid); select distinct orderdate,count(*) as N'每日订单量' from sales.orders
where orderdate between '' and ''
group by orderdate create table nums
(
n int
); select * from nums; declare @i int;
set @i=;
while @i<
begin
set @i=@i+;
insert into nums(n) values(@i);
end select dateadd(day,f.n,''),count(orderid) as N'每日订单数量'
from nums f left join sales.orders m on
dateadd(day,f.n,'')= m.orderdate
group by dateadd(day,f.n,'')
order by dateadd(day,f.n,'') select birthdate,lastname
from hr.employees
where birthdate=
(
select max(birthdate)
from hr.employees
) select * from Sales.OrderValues select custid,contactname,country
from sales.customers where custid=
(
select custid from Sales.OrderValues
where val=
(
select max(val) as N'最贵订单'
from Sales.OrderValues
)
) select * from sales.customers SELECT distinct country from sales.customers
where country not in
(
select country from production.suppliers
) select custid, count(*) as N'订单数量' from sales.orders
group by custid order by custid select distinct custid,count(*) over (partition by custid) as N'订单数量'
from sales.orders select n.custid,n.contactname,
(
select count(*)
from sales.orders m
where m.custid=n.custid
) as N'订单数量'
from sales.customers n select distinct m.country from sales.customers m
where not exists
(
select n.country from production.suppliers n
where n.country= m.country
) select distinct
(
select max(custid) from
sales.orders m where m.custid< n.custid
) as N'前一个订单',n.custid as N'当前订单',
(
select min(custid) from
sales.orders p where p.custid> n.custid
) as N'后一个订单'
from sales.orders n select n.orderyear,
(
select sum(qty)
from Sales.OrderTotalsByYear m
where m.orderyear<=n.orderyear
) as N'累计订单数量'
from Sales.OrderTotalsByYear n
order by n.orderyear; SELECT * FROM
(
SELECT custid,COUNT(*) OVER(PARTITION BY country)
FROM Sales.Customers
) t(custid,顾客数量) DECLARE @country NVARCHAR();
SET @country='UK';
WITH USE_Customers(公司名,国家名)
AS
(
SELECT companyname ,country
FROM Sales.Customers
WHERE country=@country
) SELECT * FROM USE_Customers SELECT YEAR(orderdate) AS N'年度',custid,COUNT(*) AS N'订单数量'
FROM Sales.Orders
GROUP BY YEAR(orderdate),custid
HAVING COUNT(*) >; --()
SELECT YEAR(orderdate) AS orderyear,custid
FROM Sales.Orders --()
SELECT orderyear,custid,COUNT(*) AS N'订单数量'
FROM
(
SELECT YEAR(orderdate) AS orderyear,custid
FROM Sales.Orders
) AS t1
GROUP BY orderyear,custid --()
SELECT orderyear,custid,ordercount
FROM
(
SELECT orderyear,custid,COUNT(*) AS ordercount
FROM
(
SELECT YEAR(orderdate) AS orderyear,custid
FROM Sales.Orders
) AS t1
GROUP BY orderyear,custid
) AS t2
WHERE ordercount > WITH yearorder01
AS
(
SELECT YEAR(orderdate) AS orderyear,custid
FROM Sales.Orders
),
yearorder02
AS
(
SELECT orderyear,custid,COUNT(*) AS ordercount
FROM yearorder01
GROUP BY orderyear,custid
),
yearorder03
AS
(
SELECT orderyear,custid,ordercount
FROM yearorder02
WHERE ordercount>
) SELECT * FROM yearorder03 SELECT pre_orderyear,now_orderyear,pre_custcount,now_custcount,
(now_custcount-pre_custcount) AS N'顾客数量差'
FROM
(
SELECT YEAR(orderdate) AS now_orderyear,COUNT(DISTINCT custid) AS now_custcount
FROM Sales.Orders
GROUP BY YEAR(orderdate)
) AS t1
LEFT JOIN
(
SELECT YEAR(orderdate) AS pre_orderyear,COUNT(DISTINCT custid) AS pre_custcount
FROM Sales.Orders
GROUP BY YEAR(orderdate)
) AS t2
ON t1.now_orderyear=t2.pre_orderyear+; WITH custcount
AS
(
SELECT YEAR(orderdate) AS orderyear,COUNT(DISTINCT custid) AS custcount
FROM Sales.Orders
GROUP BY YEAR(orderdate)
) SELECT t1.orderyear AS nowYear,t2.orderyear AS preYear,t1.custcount AS nowcount,t2.custcount AS precount,
(t1.custcount-t2.custcount) AS N'顾客数量差'
FROM custcount t1
LEFT JOIN custcount t2
ON t1.orderyear=t2.orderyear+; SELECT t1.empid,t1.mgrid,t1.lastname,t2.empid,t2.lastname
FROM HR.Employees t1 LEFT JOIN hr.Employees t2
ON t1.mgrid =t2.empid SELECT * FROM HR.Employees
WHERE mgrid in
(SELECT empid FROM
hr.Employees WHERE mgrid=
) DECLARE @mgrid INT;
SET @mgrid=;
WITH Emplist
AS
(
--此处为起点,执行一次
SELECT empid,lastname,mgrid
FROM HR.Employees
WHERE mgrid=@mgrid
UNION ALL --递归开始 SELECT e.empid,e.lastname,e.mgrid
FROM HR.Employees e INNER JOIN Emplist m
ON e.mgrid=m.empid ) SELECT * FROM Emplist CREATE VIEW USA_cusomers
AS
(
SELECT * FROM
sales.customers
WHERE country='USA'
) SELECT custid,country FROM dbo.USA_cusomers;
DROP VIEW dbo.USA_cusomers; SELECT country
FROM Sales.Customers
UNION
SELECT country
FROM hr.Employees; SELECT country
FROM Sales.Customers
intersect
SELECT country
FROM hr.Employees; SELECT country
FROM Sales.Customers
EXCEPT
SELECT country
FROM hr.Employees; IF OBJECT_ID('dbo.orders','U') IS NOT NULL
DROP TABLE dbo.orders;
CREATE TABLE dbo.orders
(
orderid int NOT NULL PRIMARY KEY,
empid int NOT NULL,
custid int NOT NULL,
orderdate datetime,
qty int
); INSERT INTO dbo.orders(orderid,empid,custid,orderdate,qty)
VALUES (,,,'',),
(,,,'',),
(,,,'',),
(,,,'',),
(,,,'',),
(,,,'',),
(,,,'',),
(,,,'',) SELECT * FROM dbo.orders SELECT empid,SUM(qty) AS N'顾客消费金额'
FROM dbo.orders
GROUP BY empid; SELECT empid,
SUM(CASE when empid= THEN qty end) AS N'2号顾客消费金额',
SUM(CASE when empid=3THEN qty end) AS N'3号顾客消费金额',
SUM(CASE when empid= THEN qty end) AS N'4号顾客消费金额',
SUM(CASE when empid= THEN qty end) AS N'5号顾客消费金额',
SUM(CASE when empid= THEN qty end) AS N'6号顾客消费金额'
FROM dbo.orders
GROUP BY empid; SELECT empid,[],[],[],[],[]
FROM
(
--只返回pivot中用到的列
SELECT empid,qty,custid
FROM dbo.orders
) AS t
PIVOT (
SUM(t.qty) FOR t.custid IN ([],[],[],[],[])--做列名称
) AS P USE TSQLFundamentals2008; SELECT * FROM sales.Shippers INSERT INTO Sales.Shippers
( companyname, phone )
VALUES ( N'顺风', -- companyname - nvarchar()
N'' -- phone - nvarchar()
),
(N'申通',
N''),
(
N'中通',
N''
) DELETE FROM Sales.Shippers WHERE shipperid= SELECT * FROM sales.Shippers BEGIN TRANSACTION; DELETE FROM Sales.Shippers WHERE shipperid=;
DELETE FROM Sales.Shippers WHERE shipperid=; COMMIT; BEGIN TRANSACTION; UPDATE Sales.Shippers SET companyname='abc' WHERE shipperid=;
UPDATE Sales.Shippers SET companyname='XYZ' WHERE shipperid=; COMMIT;
KILL USE TSQLFundamentals2008; BEGIN TRANSACTION; UPDATE Production.Products
SET unitprice=unitprice+
WHERE productid=; --TSQL编程
--定义变量
DECLARE @s INT;
SET @s=;
PRINT @s; DECLARE @str NVARCHAR;
SET @str ='Hello World';
PRINT @str; DECLARE @m NVARCHAR();
SELECT @m=;
PRINT @m; DECLARE @sum INT;
SELECT @sum=COUNT(*) FROM Sales.Customers;
PRINT @sum; DECLARE @mi DATETIME;
SET @mi=DATEPART(MINUTE,GETDATE());
IF(@mi>)
PRINT '该睡觉了!';
ELSE
PRINT '继续学习!' DECLARE @sumadd int;
DECLARE @k INT;
SET @k=;
SET @sumadd=;
WHILE @k<
BEGIN
SET @K=@K+;
SET @sumadd=@sumadd+@k;
END
PRINT @sumadd; SELECT companyname
FROM Sales.Customers; DECLARE @name NVARCHAR();
SELECT @name=companyname
FROM Sales.Customers;
PRINT @name; --.声明游标,基于查询
DECLARE c CURSOR
FOR
SELECT companyname
FROM Sales.Customers; DECLARE @name NVARCHAR(); --.在使用时候,必须打开游标
OPEN c; --.从游标中读取数据,每次可以读取出来一条数据
FETCH NEXT FROM c INTO @name; --.注意fetch,并不一定能获得实际的数据
WHILE @@fetch_status=
BEGIN
PRINT @name;
FETCH NEXT FROM c INTO @name; END; --.游标使用完成以后,一定要关闭
CLOSE c; --.释放游标
DEALLOCATE c; --存储过程
CREATE PROCEDURE ModifyPrice
(
@num money )
AS
UPDATE Production.Products
SET unitprice=unitprice+@num; CREATE PROCEDURE GetCustomersCount
(
@count int OUTPUT
)
AS
DECLARE @num INT;
SELECT @num=COUNT(*) FROM Sales.Customers; --传出 SET @count=@num;
go --必须使用变量来保存传出的参数
DECLARE @myCount int; --前面是参数中定义的传出参数
--后面是我们定义的用来保存输出结果的变量 EXEC GetCustomersCount @count=@myCount OUTPUT; PRINT @myCount; --创建用户
CREATE PROCEDURE CreateUser
(
@username nvarchar()
)
AS
DECLARE @namelen INT;
SET @namelen=LEN(@username); IF @namelen>
RETURN
ELSE
RETURN ; GO
--定义变量保存结果 DECLARE @ReturnValue INT;
EXEC @ReturnValue=dbo.CreateUser @username = N'liupeng' -- nvarchar()
PRINT @ReturnValue; --创建函数
CREATE FUNCTION Getminnutes
(
@datevalue datetime --传入参数
)
--函数可以直接返回一个值
RETURNS int
AS
begin
--函数体
DECLARE @mi INT;
SET @mi=DATEPART(MINUTE,@datevalue);
RETURN @mi;
END; SELECT dbo.Getminnutes(GETDATE()) --创建数据库testDB
if DB_ID('testDB') is not NULL
DROP DATABASE testDB;
CREATE DATABASE testDB ;
go
IF OBJECT_ID('testTable') IS NOT NULL
DROP TABLE testTable;
CREATE TABLE testTable
(
id INT IDENTITY(,) PRIMARY KEY NOT NULL,
userName NVARCHAR() NOT NULL,
userPWD NVARCHAR() NOT NULL,
userPhone NVARCHAR() NOT NULL
) go --插入数据
set identity_insert testTable on --设置为on时,可以向标识列中插入
declare @count int
set @count=
while @count<=
begin
insert into testTable(id,userName,userPWD,userPhone) values(@count,'liupeng','liupeng_IT','@liupengwuhan@gmail.com')
set @count=@count+
end
set identity_insert testTable off SELECT * FROM testTable create procedure proc_pagedFenye_with_selectMax --利用select top and select max(列)
(
@pageIndex int, --页索引
@pageSize int --页记录数
)
as
begin
set nocount on;
declare @timediff datetime
declare @sql nvarchar()
select @timediff=Getdate()
set @sql='select top '+str(@pageSize)+' * From testTable where(ID>(select max(id) From (select top '+str(@pageSize*@pageIndex)+' id From testTable order by ID) as TempTable)) order by ID'
execute(@sql)
select datediff(ms,@timediff,GetDate()) as 查询时间
set nocount off;
END EXEC proc_pagedFenye_with_selectMax , create procedure proc_pagedFenye_with_notin --利用select top and select not in
(
@pageIndex int, --页索引
@pageSize int --每页记录数
)
as
begin
set nocount on;
declare @timediff datetime --耗时
declare @sql nvarchar()
select @timediff=Getdate()
set @sql='select top '+str(@pageSize)+' * from testTable where(ID not in(select top '+str(@pageSize*@pageIndex)+' id from testTable order by ID ASC)) order by ID' execute(@sql) --因select top后不支技直接接参数,所以写成了字符串@sql
select datediff(ms,@timediff,GetDate()) as 查询时间
set nocount off;
END EXEC proc_pagedFenye_with_notin , create procedure proc_pagedFenye_with_Rownumber --利用SQL 2005中的Row_number()
(
@pageIndex int,
@pageSize int
)
as
begin
set nocount on;
declare @timediff DATETIME;
select @timediff=getdate()
select * from (select *,Row_number() over(order by ID asc) as IDRank from testTable) as IDWithRowNumber where IDRank>@pageSize*(@pageIndex) and IDRank<@pageSize*(@pageIndex+)
select as 查询时间
set nocount off;
END EXEC proc_pagedFenye_with_Rownumber , select * from (select *,Row_number() over(order by ID asc) as IDRank from testTable) as IDWithRowNumber where IDRank>*(-) and IDRank<*(+) SELECT* FROM testTable USE TSQLFundamentals2008;
SET NOCOUNT ON;
SELECT TOP * FROM Sales.Customers --触发器
USE TSQLFundamentals2008;
IF OBJECT_ID('shipper_log') IS NOT NULL
DROP TABLE shipper_log;
CREATE TABLE shiiper_log
(
logId INT IDENTITY(,) PRIMARY KEY,
opdate datetime DEFAULT GETDATE(),
opuser nvarchar(),
op nvarchar(),
shipname nvarchar(),
shipphone nvarchar()
) CREATE TRIGGER tg_ship
ON sales.shippers AFTER INSERT ,DELETE,UPDATE
as
INSERT INTO dbo.shiiper_log
( opdate ,
opuser ,
op ,
shipname ,
shipphone
)
SELECT GETDATE() , -- opdate - datetime
CURRENT_USER , -- opuser - nvarchar()
N'插入' , -- op - nvarchar()
companyname, -- shipname - nvarchar()
phone -- shipphone - nvarchar()
FROM INSERTED; SELECT * FROM dbo.shiiper_log; INSERT INTO Sales.Shippers
( companyname, phone )
VALUES ( N'Isoftstone', -- companyname - nvarchar()
N'' -- phone - nvarchar()
) --整个系统范围内
SELECT @@IDENTITY; --当前作用域内最新的标识值
SELECT SCOPE_IDENTITY(); select * FROM Sales.Shippers;
SQLServer学习笔记系列12的更多相关文章
- SQLServer学习笔记系列2
一.写在前面的话 继上一次SQLServer学习笔记系列1http://www.cnblogs.com/liupeng61624/p/4354983.html以后,继续学习Sqlserver,一步一步 ...
- SQLServer学习笔记系列3
一.写在前面的话 今天又是双休啦!生活依然再继续,当你停下来的时候,或许会突然显得不自在.有时候,看到一种东西,你会发现原来在这个社会上,优秀的人很多,默默 吃苦努力奋斗的人也多!星期五早上按时上班, ...
- SQLServer学习笔记系列6
一.写在前面的话 时间是我们每个人都特别熟悉的,但是到底它是什么,用什么来衡量,可能很多人会愣在那里.时间可以见证一切,也可以消磨一切,那些过往的点点滴滴可思可忆.回想往年清明节过后,在家乡的晚上总能 ...
- SQLServer学习笔记系列5
一.写在前面的话 转眼又是一年清明节,话说“清明时节雨纷纷”,武汉的天气伴随着这个清明节下了一场暴雨,整个城市如海一样,朋友圈渗透着清明节武汉看海的节奏.今年又没有回老家祭祖,但是心里依然是怀念着那些 ...
- SQLServer学习笔记系列1
一.前言 一直自己没有学习做笔记的习惯,所以为了加强自己对知识的深入理解,决定将学习笔记写下来,希望向各位大牛们学习交流! 不当之处请斧正!在此感谢!这边就先从学习Sqlserver写起,自己本身对数 ...
- SQLServer学习笔记系列4
一.写在前面的话 好多天没有记录sql学习笔记了,要坚持下去,坚信每一点的进步都是为在积蓄力量.今天看到一幅图,特此分享出来. 通过这幅图,我看到的是每人站在自己的角度看问题,感受是不一样的,就如同学 ...
- SQLServer学习笔记系列11
一.写在前面的话 身体是革命的本钱,这句放在嘴边常说的话,还是拿出来一起共勉,提醒一起奋斗的同僚们,保证睡眠,注意身体!偶尔加个班,也许不曾感觉到身体发出的讯号,长期晚睡真心扛不住!自己也制定计划,敦 ...
- SQLServer学习笔记系列10
一.写在前面的话 生活的路很长,还是要坚持走下去,自己选择的生活,就该让这样的生活放射精彩!我不奢求现在的积累,在将来能够收获多少,至少在以后的日子里回忆起来,我不曾放弃过,我坚持过,我不后悔!最近跟 ...
- SQLServer学习笔记系列8
一.写在前面的话 最近一直在思考一个问题,什么才能让我们不显得浮躁,真正的静下心来,用心去感受,用心去回答每个人的问题,用心去帮助别人.现实的生活,往往让我们显得精疲力尽,然后我们仔细想过没用,其实支 ...
随机推荐
- .NET C#-- 利用BeginInvoke与EndInvoke完成异步委托方法并获取方法执行返回值示例
//定义委托 delegate string MyDelegate(string name); //定义委托调用函数 public string Hello(string name) { Thread ...
- ios 定位
ios 定位新功能----在程序中实现定位功能 Core Location是iOS SDK中一个提供设备位置的框架.可以使用三种技术来获取位置:GPS.蜂窝或WiFi.在这些技术中,GPS最为精准,如 ...
- actor concurrency
The hardware we rely on is changing rapidly as ever-faster chips are replaced by ever-increasing num ...
- 基于Entity Framework 6的框架Nido Framework
随着 Entity Framework 最新主版本 EF6 的推出,Microsoft 对象关系映射 (ORM) 工具达到了新的专业高度,与久负盛名的 .NET ORM 工具相比已不再是门外汉. EF ...
- MyBatis(跨表查询)
1.建立数据库表如下: DROP TABLE IF EXISTS t_demo_user; CREATE TABLE IF NOT EXISTS t_demo_user( userid ), user ...
- Windows Azure Storage (23) 计算Azure VHD实际使用容量
<Windows Azure Platform 系列文章目录> 对于A系列和D系列的虚拟机来说,使用的是普通存储. 普通存储的存储资源,是按照每GB每月计费的.Microsoft Azur ...
- 固定Table的头部和左边的列-在Knockout Js使用场景下
要求:固定Table的头部和左边的列 场景:Knockout Js被用于绑定Table的数据源. 固定HTML表格的头部和列是一个很常见的需求.此文:http://www.cnblogs.com/so ...
- [大数据之Spark]——Transformations转换入门经典实例
Spark相比于Mapreduce的一大优势就是提供了很多的方法,可以直接使用:另一个优势就是执行速度快,这要得益于DAG的调度,想要理解这个调度规则,还要理解函数之间的依赖关系. 本篇就着重描述下S ...
- Atitit 代码复用的理解attilax总结
Atitit 代码复用的理解attilax总结 1.1. 继承1 1.1.1. 模式1:原型继承1 1.1.2. 模式2:复制所有属性进行继承 拷贝继承1 1.1.3. 模式3:混合(mix-in)1 ...
- 使用hexo搭建github.io博客(一)
使用github.io可以搭建一个自己的博客,把静态文件项目托管到github上,可以写博客,可以使用markdown语法,也可以展示作品.灵活性高.但是有较大的难度. node,git版本变化日新月 ...