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.
Anybody can ask a question
Anybody can answer
The best answers are voted up and moderated by our team

sql change and modify

sql change and modify

Super Learner

What is the difference between CHANGE and MODIFY in SQL?
In specific I am talking about the lecture on NOT NULL Constraint. 
Where to set a field to null we used MODIFY COLUMN but when dropping this constraint we used CHANGE COLUMN.
I tried using MODIFY COLUMN for both tasks and the results are the same, so does that mean that they are interchangeable (apart from the fact that with CHANGE COLUMN you have to repeat the name of the column).

1 Answer

365 Team

Hi Lisa!
Thanks for reaching out.
Sometimes the two options can be used as alternatives. In other situations, you can use only one or the other. For instance, as Vladimir suggested – With CHANGE you are able to change the name of a column while using MODIFY disallows that.
Throughout the course, we’ve used both to show that both can be used and because we did not want to deprive the course code from any of the two options.
That said, both are good to go in the NOT NULL Constraint lecture, as they can be interchangeable. Basically, the only difference is that you can alter a columns’ name when using CHANGE.
Hope this helps.

Complete Data Science Education
Get 50% OFF