Updated on 2023-11-27 GMT+08:00

Querying All Sample SQL Templates (Discarded)

Function

This API is used to query all sample SQL templates.

This API has been discarded and is not recommended.

URI

  • URI format

    GET /v1.0/{project_id}/sqls/sample

  • Parameter description
    Table 1 URI parameter

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.

Request

None

Response

Table 2 Parameters

Parameter

Type

Description

is_success

Boolean

Whether the request is successfully executed. Value true indicates that the request is successfully executed.

message

String

System prompt. If execution succeeds, the message may be left blank.

If the execution fails, the value will be the cause of the failure.

sqls

Array of Object

Sample template information. For details, see Table 3.

sqlCount

Integer

Number of sample templates.

Table 3 sqls parameters

Parameter

Type

Description

lang

String

Language

name

String

Name of a sample template

sql

String

Template content

description

String

Template description

group

String

Template group

Example Request

None

Example Response

{
  "is_success": true,
  "message": "",
  "sqlCount": 1,
  "sqls": [
    {
      "lang": "zh",
      "name": "Q1_ Price Summary Report",
      "sql": "-- Q1: Query pricing reports.\r\n-- Query statistics on paid and delivered offerings in a specified period in a single table lineitem, including the charging, delivery, discount, tax, and average price.\r\n-- Feature: single-table query with grouping, sorting, and aggregate operations. This query read 95% to 97% rows of data in the table.\r\nSELECT\r\n  l_returnflag,\r\n  l_linestatus,\r\n  sum(l_quantity) AS sum_qty,\r\n  sum(l_extendedprice) AS sum_base_price,\r\n  sum(l_extendedprice * (1 - l_discount)) AS sum_disc_price,\r\n  sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge,\r\n  avg(l_quantity) AS avg_qty,\r\n  avg(l_extendedprice) AS avg_price,\r\n  avg(l_discount) AS avg_disc,\r\n  count(*) AS count_order\r\nFROM\r\n  tpch.lineitem\r\nWHERE\r\n  l_shipdate <= DATE \"1998-12-01\" - INTERVAL \"90\" DAY\r\nGROUP BY\r\n  l_returnflag,\r\n  l_linestatus\r\nORDER BY\r\n  l_returnflag,\r\n  l_linestatus;",
      "description": " Query the lineitem of a table for statistics on paid and delivered offerings in a specified period, including the charging, delivery, discount, tax, and average price information.",
      "group": "tpchQuery"
    }
  ]
}

Status Codes

Status Code

Description

200

OK

Error Codes

For details, see Error Codes.