I have a table which is created from the result of a SELECT clause. Is there a way to add autoincrement primary key to each row (eg 1, 2, 3,…) My query looks like this:
CREATE TABLE tableA As( SELECT...some queries);
I tried to use:
ALTER TABLE tableA ADD PRIMARY KEY (int NOT NULL AUTO_INCREMENT);
..but it didn´t work.
In MySQL you can execute this query: