This is a mirror of official site: http://jasper-net.blogspot.com/

Interesting T-SQL problems

| Monday, August 30, 2010
With this blog post I am hoping to start a new series of blogs devoted to the interesting T-SQL problems I encounter in forums during the week.

The idea of this blog series came to me on Wednesday night when I thought I solved a complex problem...

First Problem

The first problem, I'd like to discuss, is found in this MSDN thread:

Given this table

SalesDateTime SalesAmount
2010-08-10 00:05:12 58.22
2010-08-10 00:08:22 21.10
2010-08-10 00:09:38 8.45
2010-08-10 00:18:04 9.52
2010-08-10 00:19:56 45.20
2010-08-10 11:35:15 47.12
2010-08-10 11:36:12 88.55
2010-08-10 11:40:31 45.12

find the Average Sale amount for the 15 minutes time interval.

Second Problem

The second problem is really a gem and it is presented in How can I find overlapped ranges? thread

Name Chromosome Start End
N1 chr3 17443613 17443685
N2 chr3 17443521 17443685
N3 chr2 162180459 162180499
N343 chr2 131865573 131865687
N34 chr16 34623393 34623610
N2456 chr3 17443512 17443685
N43243 chr3 17443608 17443685
The whole table is about 31,000 records (includes 22 chromosomes + X, Y chromosomes).

The problem is to find the overlapped regions (or ranges) and these overlapped records have to be on the same Chromosome of this table.

Read more: LessThanDot

Posted via email from .NET Info

0 comments: