edit-icon download-icon

SQL Summary

Last Updated: May 24, 2018

MaxCompute SQL is suitable for various scenarios including the following:

  • Massive data (GB, TB, or EB level) must be processed based on offline batch calculation. It takes several seconds or even minutes to schedule after you submit a job, therefore MaxCompute SQL is most suitable for services which need to process tens of thousands of transactions per second.

  • The syntax of MaxCompute SQL is similar to SQL. It can be considered as a subset of standard SQL. But MaxCompute SQL is not equivalent to a database, which has no database characteristics in many aspects, such as transaction, primary key constraints, index, and so on. The maximum size of SQL in MaxCompute is 2 MB.

Reserved Word

MaxCompute SQL considers the keywords of SQL statement as reserved words. These cannot be used to name tables, columns, or partitions. If reserved words are used for naming purposes, an error occurs. Reserved words are case insensitive. The reserved words in common use are shown as follows:

For the complete reserved word list, see MaxCompute SQL Reserved Word.

  1. % & && ( ) * +
  2. - . / ; < <= <>
  3. = > >= ? ADD ALL ALTER
  4. AND AS ASC BETWEEN BIGINT BOOLEAN BY
  5. CASE CAST COLUMN COMMENT CREATE DESC DISTINCT
  6. DISTRIBUTE DOUBLE DROP ELSE FALSE FROM FULL
  7. GROUP IF IN INSERT INTO IS JOIN
  8. LEFT LIFECYCLE LIKE LIMIT MAPJOIN NOT NULL
  9. ON OR ORDER OUTER OVERWRITE PARTITION RENAME
  10. REPLACE RIGHT RLIKE SELECT SORT STRING TABLE
  11. THEN TOUCH TRUE UNION VIEW WHEN WHERE

Type Conversion

MaxCompute SQL allows conversion between data types. The conversion methods include explicit type conversion and implicit type conversion. For more information, see Type Conversion.

  • Explicit conversions: Uses CAST to convert a value type to another one.
  • Implicit conversions: MaxCompute automatically performs implicit conversions during running based on the context environment and conversion rules. Implicit conversion scope includes various operators, built-in functions, and so on.

Partitioned Table

MaxCompute SQL supports partitioned table. Specifying the partition can bring lot of conveniences to users. For example, improve SQL running efficiency, reduce the cost, etc. For more information about partition, see Partition.

UNION ALL

To be involved in a UNION ALL operation, the data type of columns, column numbers and column names must be consistent, otherwise an error occurs.

Thank you! We've received your feedback.