Skip to content
Advertisement

MySQL : Insert Statement to add a record in TABLE_1

A single insert statement to add a new record in TABLE_1 for which :

  1. TABLE_1_ID value to be inserted as total count of records in TABLE_1 + 1.
  2. COLUMN_NAME will have value as “ABC”.
  3. TABLE_2_ID value should be picked from TABLE_2 based on value of COLUMN_NAME which is “ABC”.
  4. TABLE_3_ID value should be picked from TABLE_3 based on value of COLUMN_NAME which is “ABC”.

All above specified statements has to be done using Single Insert Statement. Schemas of all 3 tables are below :

TABLE_1

TABLE_2

TABLE_3

Advertisement

Answer

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement