API SQL script templates
Updated at:
This topic provides the default SQL script templates for different API operations.
GET/LIST
-- By default, the SELECT statement returns all columns.
select col1, col2, col3,…,coln from tablename
-- If the data source is MaxCompute and the table is a partitioned table, the system automatically adds a WHERE clause and uses the partition column as a condition.
select col1, col2, col3,…,coln from tablename where ds=${ds}Create
insert into tablename (col1, col2, col3,… coln) values(${col1}, ${col2}, ${col3},…,${coln})Update
By default, the WHERE clause uses equality conditions on all primary key columns. The SET statement includes all columns except the primary keys.
If no primary key exists, the statement retains the placeholder keycolumn=${keycolumn}. You must modify the WHERE clause.
UPDATE table_name
SET
column1 = ${column1},
column2 = ${column2},
column3 = ${column3}
WHERE keycolumn1=${keycolumn1} and keycolumn2=${keycolumn2}Delete
By default, the WHERE clause uses equality conditions on all primary key columns. If no primary key exists, the statement retains the placeholder keycolumn=${keycolumn}. You must modify the WHERE clause.
DELETE FROM table_name
WHERE keycolumn1=${keycolumn1} and keycolumn2=${keycolumn2}Is this page helpful?