Category Archives: SQL-related Puzzle

esProc Simplifies SQL-style Computations – Dynamically Transposing Rows and Columns

In real-world business, many computing tasks require transposing rows and columns dynamically. There are a lot of discussions around the operation in online IT groups and forums. Below lists some of them: http://www.dbforums.com/showthread.php?1628876-SQL-question-how-to-move-two-column-data-to-one-column-data https://www.linkedin.com/grp/post/137774-5981739289539526658?trk=groups-post-b-title http://stackoverflow.com/questions/29756836/mysql-pivot-table-and-numbered-columns http://www.linkedin.com/groups/need-help-86080.S.5796995228699222017?trk=groups_items_see_more-0-b-ttl SQL implements row-to-column transposition … Continue reading

Posted in SQL-related Puzzle | Tagged , , , , | Leave a comment

How esProc Assists Writing SQL Queries

esProc can simplify complex SQL-style queries using ordered sets, object-style access and stepwise computation. Usually there are two ways in which esProc is used: an independent one and one requiring integration with Java. Now let’s look at the first one … Continue reading

Posted in SQL-related Puzzle | Tagged , , | Leave a comment

Comparison between esProc Syntax and SQL Syntax for Common Computations

Structured Query Language, abbreviated as SQL, is usually used to query, store and retrieve data in databases. In esProc, users can return the query result using SQL commands directly, or process data step by step with more flexible and convenient … Continue reading

Posted in SQL-related Puzzle | Leave a comment

Parse and Update Dynamic JSON into Database with esProc

Problem source: http://bbs.csdn.net/topics/390611005 . Below is JSON data (s.json) the system acquires: { “SUCCESS”: [ { “MESSAGE”: “IMEI Service List”, “LIST”: { “MOVISTAR SPAIN”: { “GROUPNAME”: “MOVISTAR SPAIN”, “SERVICES”: { “3”: { “SERVICEID”: 32, “SERVICENAME”: “MOVISTAR NOKIA INSTANTE”, “CREDIT”: 4, “TIME”: “1-30 … Continue reading

Posted in SQL-related Puzzle | Leave a comment

Query List Fields in MongoDB Subdocuments in esProc

Problem source:https://groups.google.com/forum/#!msg/mongodb-user/HqzXSh5DZek/ffZG0TQ1w8cJ . Collection Cbetween contains cascaded subdocuments, in which the List-type dataList field includes a series of strings, each of which has multiple numbers. You need to find strings according to the criterion that the first number is greater than … Continue reading

Posted in MongoDB, SQL-related Puzzle | Leave a comment

Merge MongoDB Documents in esProc

Problem source:https://groups.google.com/forum/#!topic/mongodb-user/BpgEaRqrKsA . Below is a selection of Collection C1: { “_id” : ObjectId(“55014006e4b0333c9531043e”), “acls” : { “append” : { “users” : [ObjectId(“54f5bfb0336a15084785c393”) ], “groups” : [ ] }, “edit” : { “groups” : [ ], “users” : [ ObjectId(“54f5bfb0336a15084785c392”) ] … Continue reading

Posted in MongoDB, SQL-related Puzzle | Tagged , , | Leave a comment

esProc Implements Foreign Key Relationship for MongoDB Collections

Problem source:http://stackoverflow.com/questions/29392169/populating-field-values-for-referred-documents-in-aggregate-call-in-mongoose . With MongoDB’s built-in API, you implement a foreign key relationship through hardcoding. The hardcode is not intuitive and difficult to write. In this case you can use esProc to handle this. For example: Collection UserCourseProgres records the … Continue reading

Posted in MongoDB, SQL-related Puzzle | Leave a comment

esProc Exports Unstructured MongoDB Data as CSV Files

Problem source:https://plus.google.com/+VicNgrail/posts/ebS9JUtFopw . MongoDB allows storing unstructured data in it. But it is somewhat difficult to export the data as standard structured data. esProc, however, makes it an easy job, with MongoDB’s cooperation. Let’s look at the steps for doing … Continue reading

Posted in MongoDB, SQL-related Puzzle | Tagged , , , | Leave a comment

Group MongoDB Collection and Find Top N members in esProc

Problem source:https://groups.google.com/forum/#!topic/mongodb-user/Rjv6lyUCe1s . Collection last3 has two fields: variable and timestamp. You need to first group documents by variable and find from each group the top 3 ones with the latest timestamp, and then find from the three documents the … Continue reading

Posted in MongoDB, SQL-related Puzzle | Tagged , , , , | Leave a comment

Join MongoDB Collections with esProc

Problem source: http://stackoverflow.com/questions/29396985/is-there-a-where-like-relation-function-when-using-pymongo  . It is difficult to join MongoDB collections through hardcoding as it doesn’t directly support joins. Yet you can use esProc to perform inner join, left join and full join between collections or join the documents. Here … Continue reading

Posted in MongoDB, SQL-related Puzzle | Tagged , , , | Leave a comment