SQL Query Building Way

To meet the needs of different user groups, provides two approaches: Interactive Query Building and SQL Expression Writing, to help you construct SQL Query expressions that meet business requirements.

Interactive Query Building

Quickly specify logical statements, query fields, logical operators, etc., through dropdown options to build common SQL Query expressions, requiring no prior SQL knowledge.

The interface and steps for interactive query building are shown below:

  1. Select Expression to build queries.
  2. Expression management tools (from left to right): Import, Export, Clear, Check Expression, Function.
    • Import: Import *.xml files containing expression information. The expression input box below will automatically populate with corresponding content.
    • Export: After configuring expressions, export them to *.xml files for reuse.
    • Clear: Clear all content in the current expression input box.
    • Check Expression: Validate expression correctness. Click this button to receive feedback: "Expression correct" for valid inputs, or "Wrong expression" for errors.
    • Function: Organizes function information applicable in SQL Expressions. For details, see SQL Query Function Reference.
  3. Expression input components (from left to right): Logical statement (Where/And/Or), Query field, Logical operator, Criterion value, Delete button.
    • Logical Statement: The first clause starts with Where (non-editable). Subsequent clauses default to And, switchable to Or via dropdown.
    • Query Field: Defaults to the dataset's first field. Select from dropdown options.
    • Logical Operator: Default operator is Greater Than. Available operators vary based on query type.
    • Criterion Value: Enter manually or select from dropdown. Accepts values or field references.
    • Delete: Remove unnecessary clauses using this button.
  4. Add Clause: Click to add new expression lines for multi-condition queries.

SQL Expression Writing

Recommended for users familiar with SQL syntax and complex queries, this method enables efficient query construction through direct SQL editing.

The SQL Expression writing interface is illustrated below:

  1. Switch input mode to SQL Edit.
  2. Field list displays all dataset fields. Interactive operations include:
    • Double-click fields to insert them into the expression box.
    • Select a field and click Get to display all its values in Unique Value dropdown. Selecting a value auto-populates it into the expression box.
  3. Function list shows ten common functions. Double-click to insert them into the expression box.
  4. Expression management tools (same functionality as in Interactive Building mode): Import, Export, Clear, Check Expression, Function.
  5. Expression input box requires only WHERE clause content. Example: For full SQL "Select * from Province_R WHERE Pop_2014 > 3320 And GDP_2014 > 30000", input "Pop_2014 > 3320 And GDP_2014 > 30000". Auto-suggest shows fields and keywords matching input characters (e.g., typing "o" suggests "or", "order by", and fields starting with "o").

Related Topics

Building SQL Query

Constructing SQL Expression Query

Common SQL Query Expressions

SQL Query Function Reference

Attribute Query Example

Relational Query Example