Help Center/ Data Lake Insight/ FAQs/ Enhanced Datasource Connections/ How Do I Insert Data into an RDS Table with an Auto-Increment Primary Key Using DLI?
Updated on 2024-11-15 GMT+08:00

How Do I Insert Data into an RDS Table with an Auto-Increment Primary Key Using DLI?

When creating an associated RDS table in DLI, if the RDS table contains an auto-increment primary key or other auto-populated fields, you can take the following measures when inserting data in DLI:

  1. Omit auto-populated fields when inserting data: When inserting data in DLI, for auto-increment primary key fields or other auto-populated fields, you can omit these fields in the insert statement. The database will automatically generate values for these fields. For example, if there is an auto-increment primary key field named id in the table, you can exclude this field when inserting data, and the database will assign a unique id value for the newly inserted row.
  2. Use NULL values: If you need to explicitly specify that certain fields should be auto-populated by the database when inserting data, you can fill in NULL values in those fields. This way, the database will recognize that these fields should be automatically generated by the system, rather than specified by the user.