* How to use SQL to query text?

Key words: Text    Calculate text    SQL query text

The data query scenario is very simple to write in SQL, for example: Select... From... Where...    But it is impossible to directly use SQL on the file. The general practice is to create a temporary table in the database, parse the text into the database, and then use SQL to query, filter, group and so on.

But the implementation process is too cumbersome. The main inconveniences are as follows:

1. The code for parsing and importing into database is very long, as well as the configuration of the development environment and other factors, which generally requires professional skills for personnel.

2. Although it is not difficult to install the database and create temporary tables, it is tedious.

3. For some temporary and sudden demands, the development cycle is long, and some scenarios do not allow the installation of database, which is hard to handle. It is very difficult to write all codes in high-level programming language.

It would have been much simpler if you had used esProc SPL. It directly provides the ability of SQL query and calculation for files (txt, Excel, etc.). For example:


A

B

1

$select * from scores.txt where class=10

/Filter

2

$select class,avg(english) as avg_en from scores.txt   group by class

/Group and aggregate

3

$select sum(S.quantity*P.Price) as total from sales.txt as S join   products.txt as P on S.productid=P.ID where S.quantity<=10

/join,filter,aggregate

In fact, there are many scenarios where it needs to parse and calculate text. It will be very simple to use esProc SPL directly, please refer toStructured Text Computing with esProc

esProc is also a professional tool for file data source processing. It can easily perform mixed calculation, importing into and exporting out of database of various file data, such as TXT, Excel, XML, JSON, CSV, ini, etc.

A desktop computing tool, esProc is ready to use, with simple configuration and complete debugging functions: breakpoints and single step execution can be set, and the result of each step can be viewed. The syntax is simple, in line with people's natural thinking, and simpler than other advanced development languages. Please refer to: http://www.raqsoft.com/html/file-processor.html

esProc is integration-friendly. Read How to Call an SPL Script in Java to see how we can easily embedded an SPL script into a Java program.

Read Getting Started with esProc to download and install esProc, get a license for free and find related documentation.