August 8, 2012

esProc vs SQL: Dissociative Record

Here we will show an example about how SQL and esProc to express the same case on dissociative record.

Example:
Firstly, find out the age of Tom;
Then, find out how much Tom is older than David;
Finally, find out how many days Tom’s on-boarding is earlier than Harry’s.


   SQL Solution:



   esProc Solution

In order to simplify the SQL statement as much as possible in the comparison examples, the window functions of SQL 2003 standard are widely used, and accordingly the Oracle database syntax which has best support for SQL 2003 is adopted in this essay.

No comments:

Post a Comment