I'm rather new to fiddling around in SQL and MySQL, although I stumbled upon this problem. I'm trying to get a number of how many rows are there in one table and set this number onto anothers AUTO_INCREMENT value. The problem is, MySQL workbench triggers a syntax error when I try to assign value via a variable. I tried to convert the query to unsigned integer, although not sure if it did work. Query for row amount returns the required number. What am I doing wrong?
SET @size = CONVERT((SELECT TABLE_ROWS FROM information_schema.tables WHERE table_name='Persons' and table_schema = 'Movies2'), unsigned);
ALTER TABLE Movies2.Actors AUTO_INCREMENT=@size;