I have a file with .sql extension in which I write a query like insertions, deletions or updates, and execute it in toadformysql . I repeat the same action many times because I have lot of queries, so it turned out that I have a lot .sql files. for the first query It works . but When I tried to add a second query in the same file and execute it , there are errors because the first query has already been executed. If the first query is delete for example, it displays an error "no such column" , which is logic beacuse I already delete the column. Is there a way that I can have a single file in which I add all my queries and while executing it , I won't have errors from old queries like duplicates or others, something like errors handling. It is because I have to keep an history of all queries. Only the query that I didn't already execute will throw an error if there is.
for example if my first query is
ALTER TABLE adbproject DROP COLUMN imageFormat
and I execute it. for the second time I want to add another query which is:
ALTER TABLE PERSON ADD MATRICULE VARCHAR(50) AFTER CODE;
So the file will to be executed will be :
ALTER TABLE adbproject DROP COLUMN imageFormat;
ALTER TABLE PERSON ADD MATRICULE VARCHAR(50) AFTER CODE;
but I have logically this error : Can't DROP 'imageFormat'; check that column/key exists. I am searching a way to avoid this error.
Thanks in advance