Last answered:

17 Apr 2020

Posted on:

14 Apr 2020

0

Can we revoke DROP statement by deleting the code line

CREATE TABLE customers; DROP TABLE customers; instead of writing code "CREATE TABLE customers;" , Can I just simply delete the "DROP TABLE customers;" and execute the procedure?
2 answers ( 0 marked as helpful)
Instructor
Posted on:

15 Apr 2020

0
Hi Jo! Thanks for reaching out. This will depend on the state of your database at the moment of the execution of these queries.  For instance, if you have already created the 'customers' table, you don't need to execute
CREATE TABLE customers...;
However, the following statement can lead to an error if 'customers' didn't exist at the moment of execution.
DROP TABLE customers;
That's why the practice requires to execute the same statement, practically, with the following addition.
DROP TABLE IF EXISTS customers;
What I explained so far, is valid in general. And, it could be applicable in your case, if you only referred to the lecture you indicated. However, as you will see further down the syllabus of this course, there is a type of SQL stored routines, called SQL stored procedures. If that's what you referred to, then the specificity of my answer would depend on the content of the query creating the procedure you are referring to. Hope this helps.
Best,
Martin  
Posted on:

17 Apr 2020

0
Thank you, Martin.

Submit an answer