How do you convert complex business logic into codes, with SQL or esProc?
-
To find the maximum consecutive days when the stock keeps rising SQL: 1 select max (continuousDays) 2 from (select count(*) continuousDays 3 from (select sum(changeSign)over(order by tradeDate) unRiseDays 4 from (select tradeDate, 5 case when closePrice>lag(closePrice) over(order by tradeDate) 6 then 0 else 1 end changeSign 7 from stock) ) 8 group by unRiseDays) esProc: A 1 = stock.sort(tradeDate) 2 = 0 3 = A1.max(A2=if(closePrice>closePrice [-1], A2+1,0)) SQL is generally used by most users for data computing and analytics, but esProc is a new script language, what do think of such two scripts?
-
Answer:
The examples in this question are just silly. Why not just say with an RDBMS one could have the business logic done with ETL or a materialized view and the SQL really should look like this. 1:= Select max(day) from table where consec_day_rising = True; Or we could make a function and the sql could be even smaller or longer if we want it to be easier to read. 1:= select get_max_day(True) from dual; or 1:= select stock_analysis.get_max_day(p_consec_day_rising := True) from dual; Could we say either one these lines of very small SQL code is way better than esProc? Of course not. SQL is just one part of a way to assert a data model in an RDBMS. It provides multiple functions Creates/Alters data structures Inserts/Updates/deletes data in the Structures Builds a collection of data from data structures Displays results from a collection of data Derives new data within a collection Depending on the platform one can wrap the SQL in a programing language with more programmatic options. Converting business logic to an RDBMS platform with SQL will be just part of the process of data abstraction, modeling, and development of ETL, API's and views that one will use. esProc looks like a specific proprietary implementation that makes a lot of choices for you to answer specific kinds of analytic questions. Though I have not used this software before I have reviewed its website. I am not historically fond of overly GUI cartoon to code tools. They generally solve 80% of a problem really well but the remaining 20% is divided up into either only kind of solved and out of scope. This 20% usually requires lots of hacks and band aids to survive in a complex production world. I also do not agree with the tone of the esProc vs SQL propaganda they are putting out. It should not really be a esProc vs SQL. It makes me think they are riding the NoSQL bandwagon but think NoSQL means Not SQL instead of Not Only SQL. It might be a cool product for doing some stuff. Especially for companies that have problems building their own tools. They should focus on that. I prefer building my own tools if that bias is not clear but I am paid to implement off the shelf stuff all the time and might even pick esProc some day at least for an RFP.
Andrew Hansen at Quora Visit the source
Related Q & A:
- How To Send a Complex Object to a Rest Web Service?Best solution by codeproject.com
- How do I automate complex software distribution?Best solution by Server Fault
- How to write a complex query with doctrine?Best solution by Stack Overflow
- How can I convert the query from SQL to LINQ?Best solution by Stack Overflow
- How can I sell my Case Logic product?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.