title: How to automate insert id into child table with new created id from parent
body: <p>How to make as default insert with id_user into child user_id? I will make at once update without extra select and insert in my program. Is this possible?</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `users` (
    `id_user` int(10) NOT NULL AUTO_INCREMENT,
    `name` varchar(25) NOT NULL DEFAULT '',
    PRIMARY KEY (`id_user`)
  ) ENGINE=InnoDB;
  
  CREATE TABLE IF NOT EXISTS  `scores` (
   `user_id` INT( 10 ) NOT NULL DEFAULT  '0',
   `score` INT( 10 ) NOT NULL DEFAULT  '0',
  PRIMARY KEY (`user_id`),
  CONSTRAINT FOREIGN KEY ( `user_id` ) REFERENCES  `users` ( `id_user` )
      ON UPDATE CASCADE
  ) ENGINE = INNODB;
  
  INSERT INTO users (name) VALUES ('i am');
  
  UPDATE scores SET score = '10' WHERE user_id = '1';
  </code></pre>