CREATE TABLE ステートメント
新しいSmartsheet エンティティを作成するには、CREATE TABLE ステートメントを使用します。
CREATE TABLE 構文
CREATE TABLE ステートメントは、次の例に示すように、テーブル名、カラム名のカンマ区切りリスト、テーブルの主キーを指定します。
CREATE TABLE <table_name> [ IF [ NOT EXISTS ] ]
(
{
<column_name> <data_type>
[ NOT NULL ]
[ DEFAULT <literal> ]
[ PRIMARY KEY ]
[ UNIQUE ]
} | PRIMARY KEY ( <column_name> [ , ... ] )
[ , ... ]
)
Columns definitions for data types which cannot be directly mapped to a Smartsheet data type (for example, boolean -> CHECKBOX) are mapped to the generic Smartsheet TEXT_NUMBER type (for example, datetime -> TEXT_NUMBER). In order for the 本製品 to identify the correct SQL data type for these columns later on during metadata retrieval, ensure that TypeDetectionScheme is set to RowScan; the default behavior. This applies to ALTER TABLE statements as well.
次のステートメント例は、名前、年齢、および住所カラムを持つMyCustomers テーブルをSmartsheet サーバーに作成します。
CREATE TABLE IF NOT EXISTS [MyCustomers] (name VARCHAR(20), age INT, address VARCHAR(20))