반응형

COMPUTE BY 절을 이용하면 하나의 SELECT 문으로 세부 행과 요약 행을 모두 볼 수 있습니다. 또한 하위 그룹에 대한 요약 값을 계산하거나 전체 결과 집합의 요약 값을 계산할 수 있습니다.

COMPUTE 절에는 다음 정보를 지정해야 합니다.

  • 선택적 BY 키워드. 열 기준당 지정된 행 집계를 계산합니다.

  • 행 집계 함수 이름. SUM, AVG, MIN, MAX 또는 COUNT가 포함됩니다.

  • 행 집계 함수를 실행할 열

COMPUTE로 생성된 요약 값은 쿼리 결과에서 별도의 결과 집합으로 나타납니다. COMPUTE 절이 포함된 쿼리의 결과는 사용자가 지정한 그룹이나 구분에 따라 요약 값을 제어하는 CONTROL-BREAK 보고서와 비슷합니다. 그룹별 요약 값을 계산하고 같은 그룹에 대한 집계 함수를 두 개 이상 계산할 수도 있습니다.

선택적 BY 절과 함께 COMPUTE를 지정하면 각 그룹별로 SELECT의 조건을 충족하는 두 개의 결과 집합이 생성됩니다.

  • 각 그룹의 첫 번째 결과 집합은 해당 그룹의 SELECT 목록 정보가 포함된 세부 행 집합입니다.

  • 각 그룹의 두 번째 결과 집합은 해당 그룹의 COMPUTE 절에 지정된 집계 함수의 부분합이 지정된 한 행입니다.

선택적 BY 절 없이 COMPUTE를 지정해도 SELECT의 조건을 충족하는 두 개의 결과 집합이 생성됩니다.

  • 각 그룹의 첫 번째 결과 집합은 SELECT 목록 정보가 포함된 모든 세부 행입니다.

  • 두 번째 결과 집합은 COMPUTE 절에 지정된 집계 함수의 합계가 포함된 한 행입니다.

다음은 간단한 COMPUTE 절을 사용하여 SalesOrderDetail 테이블에서 단가와 할인액의 총계를 반환하는 SELECT 문입니다.

USE AdventureWorks2008R2;
GO
SELECT SalesOrderID, UnitPrice, UnitPriceDiscount
FROM Sales.SalesOrderDetail
ORDER BY SalesOrderID
COMPUTE SUM(UnitPrice), SUM(UnitPriceDiscount);

 

다음은 선택적 BY 키워드를 COMPUTE 절에 추가하여 각 판매 주문의 부분합을 반환하는 쿼리입니다.

USE AdventureWorks2008R2;
GO
SELECT SalesOrderID, UnitPrice, UnitPriceDiscount
FROM Sales.SalesOrderDetail
ORDER BY SalesOrderID
COMPUTE SUM(UnitPrice), SUM(UnitPriceDiscount) BY SalesOrderID;

SELECT 문은 각 판매 주문에 대해 두 개의 결과 집합을 반환합니다. 각 판매 주문의 첫 번째 결과 집합은 SELECT 목록에서 지정한 정보가 포함된 행 집합이고 두 번째 결과 집합은 COMPUTE 절에 지정된 두 가지 SUM 함수의 부분합입니다.

참고참고

osql과 같은 유틸리티는 각 부분합이 결과 집합에서 별도의 행으로 보이도록 여러 개의 부분합이나 합계 요약을 표시합니다. 이것은 유틸리티에서 결과를 표시하는 방식 때문이며 부분합이나 합계는 한 행에 반환됩니다. SQL Server Management Studio와 같은 응용 프로그램에서는 여러 종류의 집계를 같은 줄에 표시합니다.

 

 

COMPUTE와 GROUP BY의 차이를 요약하면 다음과 같습니다.

  • GROUP BY는 단일 결과 집합을 반환합니다. 각 그룹별로 그룹화 열과 해당 그룹의 하위 집계를 보여 주는 집계 함수가 포함된 하나의 행이 있습니다. SELECT 목록에는 그룹화 열과 집계 함수만 포함될 수 있습니다.

  • COMPUTE는 여러 결과 집합을 반환합니다. 각 그룹별로 SELECT 목록의 식이 있는 세부 행이 포함된 결과 집합과 그룹의 하위 집계나 SELECT 문의 합계가 포함된 결과 집합이 있습니다. SELECT 목록에는 그룹화 열이나 집계 함수가 아닌 식이 포함될 수 있으며 집계 함수는 SELECT 목록이 아니라 COMPUTE 절에 지정됩니다.

다음은 GROUP BY와 집계 함수를 사용하는 쿼리입니다. 이 쿼리는 각 그룹별로 해당 그룹의 부분합이 포함된 행이 있는 단일 결과 집합을 반환합니다.

USE AdventureWorks2008R2;
GO
SELECT SalesOrderID, SUM(UnitPrice), SUM(UnitPriceDiscount)
FROM Sales.SalesOrderDetail
GROUP BY SalesOrderID;
참고참고

COMPUTE나 COMPUTE BY 절에는 ntext, text 또는 image 데이터 형식을 포함할 수 없습니다.

 

반응형
반응형

Brainy.io: Share Backbone code between server and client

brainyio

Homepage: http://brainy.io/
GitHub: http://github.com/brainyio

 

a bare bones Backbone boilerplate using RequireJS

 

 

brainy-boilerplate

a client side boilerplate implementing Backbone and RequireJS.

 

 

반응형
반응형

꿈, 믿음, 희망, 사랑, 다 나눌수록 더 커지는
기적의 씨앗들입니다.
꿈은 꿈을 부르고 믿음은 믿음을 더하고,
희망은 희망을 낳으며,
사랑은 허물을 덮습니다.
-조정민, ‘사람이 선물이다’에서

 

수많은 좋은 것들은 나눌수록 더 커지고,
나누는 데 큰 비용이 들지도 않습니다.
내가 먼저 꿈꾸고, 내가 먼저 믿어주고,
내가 먼저 사랑하고, 먼저 나눔으로써
‘나눌수록 더 커지는 기적’을 모두 함께 만들어 갈 수 있는
멋진 한 해 될 수 있길 기원합니다.

 

반응형
반응형
레볼루션


영어로 혁명을
'레볼루션'이라고 하는데,
시계 바늘이 한 바퀴 원을 도는 것 또한
'레볼루션'이라고 한다. 새벽이 오기 전에
어둠이 가장 짙어지듯이, 끝이라고 절망할 것도
아니며 새로운 시작이라고 자만할 것도 아니다.
쉴 새 없이 움직이는 초침, 분침, 시침의
아날로그 시계에 과거와 현재와 미래의
시간이 동시에 나타난다.


- 한홍의《시간의 마스터》중에서 -


* 한 시간 한 시간이 레볼루션입니다.
하루 하루가 자기 삶의 레볼루션입니다.
한 해 한 해가 자기 인생의 레볼루션입니다.
12월31일, 오늘! 한 해를 마감하는 '레볼루션'의
꼭지점에서, 올 한 해 나는 얼마나 변했는지,
얼마나 성장했는지 점검해 볼 시간입니다.
사랑하고 감사할 것이 무엇이며,
못보고 놓친 것은 없었는지
되돌아볼 시간입니다.



 

반응형

'생활의 발견 > 아침편지' 카테고리의 다른 글

좋은 디자인일수록...  (0) 2014.01.02
오늘  (0) 2014.01.01
어머니의 소리  (0) 2013.12.30
새해에는...  (0) 2013.12.28
"아래를 내려다보지 말라"  (0) 2013.12.27
반응형

 

쿡스투어
국내도서
저자 : 앤서니 보뎅 / 장성주역
출판 : 컬처그라퍼 2009.02.10
상세보기

 

반응형
반응형

Makeappicon: Generate properly sized icons quickly and easily

makeappicon

 

반응형
반응형

10 Best jQuery Plugins for December 2013

 

1. Adaptive Backgrounds

adaptive-backgrounds
Adaptive Backgrounds is a jQuery plugin for extracting dominant colors from images and applying it to its parent element. This plugin utilizes the canvas element and the ImageData object, and due to cross-site security limitations, the script will fail if one tries to extract the colors from an image not hosted on the current domain, unless the image allows for Cross Origin Resource Sharing.

Source

2. Dynatable

dynatable
Dynatable is a funner, semantic, interactive table plugin using jQuery, HTML5, and JSON. And it’s not just for tables. The purpose of Dynatable is to provide a simple, extensible API, which makes viewing and interacting with larger datasets easy.
Dynatable provides a framework for implementing the most common elements out of the box, including sorting, searching and filtering. Above all, Dynatable is a clean and elegant API that is fun to use.

Source

3. jQuery Label Better

jquery-label-better
jQuery Label Better helps you label your form input like a boss with beautiful animation and without taking up space. The uniqueness about this plugin is that all you have to do is add a placeholder text, and we will show the label only when the user needs it.
To add this to your website, simply include the latest jQuery library together with jquery.label_better.js into your document’s head, and simply call the function. Modern browsers such as Chrome, Firefox, and Safari on both desktop and smartphones have been tested.

Source

4. sDashboard

sdashboard
sDashboard is a simple & light weight dashboard jQuery plugin that converts an array of objects into a dashboard. Each object in the array would be rendered as a dashboard widget that can be rearranged by dragging around.
sDashboards has built in support for rendering datatable’s and flotr2 charts. It also has support to listen for events such as table row click, chart data click and data selection built-in. sDashboard depends on the following libraries: jQuery, jQuery UI, Datatables and Flotr2 charts (required for charting widgets).

Source

5. Multi Level Push Menu

multilevel push menu
Multi-level push menu is cross-browser compatible jQuery plug-in allowing endless nesting of navigation elements. It has support for unlimited levels, works cross browser/platform and makes things much easier for touch devices with swipe gestures. The menu can be set to next from left-to-right or right-to-left and all works with a simple markup (unordered lists).

Source

6. Alloftheheights. Js

alloftheheights
Allofthelights.js is a jQuery plugin that can change the opacity of the whole webpage but leave the video player. This is for helping the user to easily focus on the video and there is built-in support for YouTube, Vimeo, DailyMotion.. and custom players can be added too. It works with multiple players on the same page and supports responsive layouts/players with no issues. The animation speed, background color and opacity can all be customized an callback functions exist.

Source

7. PhotoJShop

photojshop
PhotoJShop is a jQuery plugin that enables us to apply such simple effects/filters to images. These filters include blur, sepia, emboss, lighten, darken, b&w, sharpen and more. The plugin works on canvas + images and the filters to be applied can be chained for easier usage.

Source

8. jQuery Interactive 3D

jQuery Interactive 3D
jQuery Interactive 3D is a plugin that allows us to accomplish a similar functionality using multiple images. It is so easy to use and works with a simple function and a list of specifically-named images. And, there are options for customization like the cursor icon, speed, touch support, auto-play and more.

Source

9. jQuery Lazy Load XT

lazyload
Lazy Load XT is a jQuery plugin for loading effects on images, videos, and other media. It works with YouTube videos, jQuery mobile, the Zepto library, and much more.

Source

10. jQuery Restable

restable
jQuery ReStable is a jQuery plugin that makes your tables responsive by turning them into UL lists when necessary. It’s lightweight, around 1kb, and very simple.

Source

반응형
반응형

나의 일상은 지극히 단조로운 날들의 반복이었다.
잠자고 일어나서 밥 먹고 연습,
자고 일어나서 밥 먹고 다시 연습,
어찌 보면 수행자와 같은 하루하루를 불태웠을 뿐이다.
조금 불을 붙이다 마는 것이 아니라,
재까지 한 톨 남지 않도록 태우고 또 태웠다.
그런 매일 매일의 지루한, 그러면서도 지독하게 치열했던
하루의 반복이 지금의 나를 만들었다.
-강수진, ‘나는 내일을 기다리지 않는다.’에서

 

세계적 발레리나 강수진은
자신이 생각하는 가장 큰 업적, 가장 듣고 싶은 찬사는
‘보잘 것 없어 보이는 하루하루를 반복하여
대단한 하루를 만들어 낸 사람’이라고 합니다.
지극히 규칙적이고 지루한 반복적 일상이
위대함을 만듭니다.

 

반응형

+ Recent posts