Search code examples
mysqlsql-updaterow

MySQL Update First Row In Table


I have a table with single column.

EmailTable

NotifyEmail
[email protected]

No id no nothing just single row single column. So how do I update this row with new value?

I tried:

UPDATE NotifyEmail
FROM EmailTable
SET [email protected]

It's not working.

edit, my table do not have ID. It's just a single column.


Solution

  • The MySQL UPDATE statement has the following syntax:

    UPDATE table_name
    SET column1 = value1, column2 = value2, ...
    WHERE condition;
    

    so, in your case, you should write the following query:

    UPDATE EmailTable
    SET NotifyEmail = '[email protected]'
    WHERE NotifyEmail = '[email protected]';