The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

Can we revoke DROP statement by deleting the code line

Can we revoke DROP statement by deleting the code line

Super Learner
0
Votes
2
Answer

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

365 Team
0
Votes

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
 

Super Learner
0
Votes

Thank you, Martin.

You are welcome!

4 months