0
update a data in mysql, adding data to a null column of an existing row. is it possible?
i have a c# winform that has a login function that sends its data to my table in mysql. my table has 4 columns, id-username-password-message. when i register a new user it creates a new row right? then the message column becames null. then here goes what i want to achieve- to add a value on the 'message' column in the same row for my registered user. how will i do it?
3 Respuestas
+ 2
Why are you mixing up user information with the 'message' here. What is the relevance of the 'message' field with a user info?
+ 1
you can create dafault value with DEFAULT keyword
https://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html
+ 1
If you want to change your existing data:
update your_table
set message='default message'
where message is null;
if you want to set up a default value for new rows that will be insterted in the future:
alter table your_table
alter message
set default 'default_message';