Omnipresent sets

  • Ubiquity of sets

The set is a widely-applied basic data type. For example, the order paid in this quarter, the list of premium clients (set A1), and the Top 500 enterprise (set B1).

  • Provides the perfect set operations

esProc provides the set operation (intersection, union, compliment, and other operations) that can materialize the abstract basic data, convert them to the business understandable language, and carry out the stepwise computations according to the business requirements. In this way, the complexity is greatly reduced. For example, you can directly use A1^B1 to select out the Top 500 clients among those premium clients.
       By compassion, the stepwise computation is not favored and thus the set is also unsupported by SQL. The high level language cannot support the set operation directly, requiring programmers to implement a great many lines of codes

A
1 =db.query(“select * from Employee”)
2
=A1.select(Gender==”Male”)
Male employees
3
=A1.select(Birthday>=date(“1970-01-01”))
Employees born in and after 1970
4
=A2^A3
Intersection operation to count male employees born in and after 1970
5
=A2&A3
Union operation to count employees born in and after 1970,and male employees
6
=A2\A3
Subtraction operation to count male employees who are born before 1970
7 =A4.sum(Salary) Total salary of male employees born in and after 1970
8 =A5.avg(Age) Average age of male employees and employees born in and after 1970
9
=A6.sort(Birthday)
Sorting by ages of male employees born before1970