Facebook Twitter Sign in | Join
Pushing database changes needn't be hard work with SQL Compare
Getting Started with ASP.NET MVC - Part 5: How to do programming with razor syntax
First Time? You can support us by signing up. It takes only 5 seconds. Click here to sign up. If you already have an account, click here to login.

TSQL Challenge 19 - Working with consolidated calculations on hierarchical structures

This challenge is related to Work with consolidated calculations on hierarchical structures.


http://beyondrelational.com/puzzles/challenges/23/working-with-consolidated-calculations-on-hierarchical-structures.aspx

Share

Comments

# re: TSQL Challenge 19 - Working with consolidated calculations on hierarchical structures

Monday, December 14, 2009 1:35 PM by Ramireddy

Hi,

Media Gallery is not allowing to upload the solutions..

There is some issue in it.....


# re: TSQL Challenge 19 - Working with consolidated calculations on hierarchical structures

Monday, December 14, 2009 10:24 PM by Jacob Sebastian

I doubt it is an issue with the browser you are using. In the past we had similar issues with google chrome. I would suggest you use a different browser and try again.


# re: TSQL Challenge 19 - Working with consolidated calculations on hierarchical structures

Monday, December 14, 2009 11:00 PM by Ramireddy

Thanks Jacob,

I will use google chrome only in my home..... Anyway, I uploaded from my office, where i have only IE..


# re: TSQL Challenge 19 - Working with consolidated calculations on hierarchical structures

Tuesday, December 15, 2009 6:28 AM by Roby Van Hoye

For some reason I'm unable to use 'reply' on the forum... The error thrown seems to indicate a security problem :

---

Access Denied: Reply Permission Denied

Either the forum does not exist or you do not have permissions to reply to posts within the forum.

---

I have a question though : why do you guys "insist" to have the input data in Table variables ? They kind of behave different (read : worse) than ordinary tables which is where data normally resides (eg. statistics, indexes, ...) And they make testing slow as for each test one has to declare + load the table again (from an existing table).

=> Wouldn't it be a lot easier to have an empty database with just those tables in it ? The added benefit of (potentially) having indexes on said input data might make the challenge a bit more realistic. Besides, let's agree : @emp and @order don't even have proper PK's !?!? What kind of an example is that in an advanced SQL Challenge ? =/

ps: as for the 'only one query allowed, no variables etc' - rules, I'm no fan of that either as (often) means working around limitations instead of using the full potential of the system. Then again, nobody is forcing me to take part in this =)


# re: TSQL Challenge 19 - Working with consolidated calculations on hierarchical structures

Tuesday, December 15, 2009 6:59 AM by Jacob Sebastian

Hi Roby,

You need to be a member of the group 'tsql challenges' to be able to post a message in the forum. beyondrelational.com/.../default.aspx

rgds

Jacob


# re: TSQL Challenge 19 - Working with consolidated calculations on hierarchical structures

Thursday, December 17, 2009 5:39 PM by Erick

Hello,

What if a person has no orders. Should they appear in the results?


# re: TSQL Challenge 19 - Working with consolidated calculations on hierarchical structures

Thursday, December 17, 2009 6:03 PM by Erick

Found the answer in the forum


# re: TSQL Challenge 19 - Working with consolidated calculations on hierarchical structures

Tuesday, December 22, 2009 3:20 PM by jcelko

This is so much easier if the organizational chart hierarchy is modeled with a Nested Sets Model and not an Adjacency List Model.


# re: TSQL Challenge 19 - Working with consolidated calculations on hierarchical structures

Wednesday, December 23, 2009 8:04 AM by Sergejack

Should the solution works with million(s) of lines?


# re: TSQL Challenge 19 - Working with consolidated calculations on hierarchical structures

Wednesday, December 23, 2009 8:40 AM by Jacob Sebastian

we use a large table to do a performance test of the solutions. it may not be always 1 million..sometimes less and some times more depending upon the nature of the challenge.

We will be able to decide the number of rows to test only when the evaluation starts. So I would suggest you make sure that your solution is optimized to the maximum possible so that it will return best results when testing with larger set of data.


Copyright © Beyondrelational.com