sql

Post

Posts tagged as "sql"

1 comment   |   MySQL, SQL
The right way to restore mysql dump with InnoDB tables

The right way to restore mysql dump with InnoDB tables

Add this to the beginning of dump SET AUTOCOMMIT = 0; SET FOREIGN_KEY_CHECKS=0; and this to the end SET FOREIGN_KEY_CHECKS = 1; COMMIT; SET AUTOCOMMIT = 1;

Comments   |   SQL
Use MAX() with INSERT query

Use MAX() with INSERT query

Hi, today I ran into a problem - I had to use the MAX() function while Inserting data into database. I write a simple query: INSERT INTO `table` (row1,row2) VALUES(`sample`,MAX(row2)+1) And I got an error #1111 – Invalid use of group function So I start to think and find the right way to compose my query: INSERT INTO `table` (row1,row2) VALUES(`sample`,(SELECT ...