Here we are using table named student table under student details database
Query to add a column named Address to the table
Alter table student table
Add column Address varchar (255)
On the other hand let's discuss update statement
UPDATE SQL command is a DML (Data manipulation Language) statement. It is used to manipulate the data of any existing column. But can’t change the table’s definition.
UPDATE Syntax
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Let's apply update statement with the same example
Set the address of std_id 4 as kolkata
Update student table
Set address ='Kolkata '
Where std_id =4
After running the query we can see the result address of std id 4 as kolkata
So after a brief discussion of alter and update statement we can evaluate the difference between them
1)ALTER command is Data Definition Language (DDL)wheras UPDATE Command is a Data Manipulation Language (DML).
2)Alter command will perform the action on structure level and not on the data level wheras Update command will perform on the data level.
3)ALTER Command is used to add, delete, modify the attributes of the relations (tables) in the database wheras UPDATE Command is used to update existing records in a database.
4)ALTER Command by default initializes values of all the tuple as NULL wheras UPDATE Command sets specified values in the command to the tuples
5)This command make changes with table structure wherasThis command makes changes with data inside the table.
So that's all for today Hope you all will get some help from this video
If it's so then don't forget to subscribe my channel Code with Neha and press the Bell Icon for Regular Updates
See you in the next video till then Stay Safe Stay Happy
#mysql
#mysqldb
#mysqltutorials
#mysqltutorialforbeginners
#mysqlupdatecommand
#sqlupdatecommand
#updatedatawithsql
#updatetabledatainmysql
#mysqldatabasetutorial
#updatingadatabase
#alterstatementinmysql
#alterstatementinsql
#Updatestatementinmysql
#Updatestatementinsql
#updatestatementinsql
#alterinsql
#alterinmysql
#updateinmysql
#updateinsql
#updatequeryinsql
#mysqlupdatequery
#whatisupdateinmysql
#sqlupdate
#mysqlupdatestatement
#mysqldatabase
#mysqlcourse
#mysqldatabasetutorial
#mysqlcrashcourse
#mysqltutorialforbeginners
#learnmysql
#learnsql
#SqlDMLcommands
#createinsertupdateinsql
#sqlupdatequery
#sqlcommands
#sqlqueries
#structuredquerylanguage
#sqlinterviewquestions
#sqlbasics
#sqlforbeginners