Главная » Ошибки » Как бороться с ошибкой MySQL следующего содержания: “ERROR 1054 (42S22): Unknown column ‘Password’ in ‘filed list'”?

Как бороться с ошибкой MySQL следующего содержания: “ERROR 1054 (42S22): Unknown column ‘Password’ in ‘filed list'”?

Войдите, чтобы написать ответ

Войти через центр авторизации

<хедер class="section-хедер">

Похожие вопросы

  • mysql
    • MySQL

    • +2 ещё

    Простой

Как отобразить картинку на сайте из MySQL используя Spring?

  • 1 подписчик
  • 23 часа назад
  • 65 просмотров

ответа
2

  • mysql
    • MySQL

    Средний

  • Preview 0

    Existing Members

    Sign in to your account

    Fix ERROR 1054 on an UPDATE statement

    To fix the 1054 error caused by an UPDATE statement, you need to look into the SET and WHERE clauses of your statement and make sure that the column names are all correct.

    You can look at the error message that MySQL gave you to identify where the error is happening.

    For example, the following SQL statement:

    UPDATEusersSETusername=”jackfrost”,display_name=”Jack Frost”WHEREuser_name=”jackolantern”;

    Produces the following error:

    ERROR 1054(42S22): Unknown column ‘user_name’ in ‘where clause’

    The error clearly points toward the user_name column in the WHERE clause, so you only need to change that.

    If the error points toward the field_list as shown below:

    ERROR 1054(42S22): Unknown column ‘displayname’ in ‘field list’

    Then you need to check on the SET statement and make sure that:

    • You have the right column names
    • Any string type values are enclosed in a quotation mark

    You can also check on the table name that you specified in the UPDATE statement and make sure that you’re operating on the right table.

    Next, let’s look at how to fix the error on an ALTER TABLE statement

    Conclusion

    In short, ERROR 1054 means that MySQL can’t find the column name that you specified in your SQL statements.

    It doesn’t matter if you’re writing an INSERT, SELECT, or UPDATE statement.

    There are only two things you need to check to fix the error:

    • Make sure you’ve specified the right column name in your statement
    • Make sure that any value of string type in your statement is surrounded by a quotation mark

    You can check on your table structure using the DESCRIBE or EXPLAIN statement to help you match the column name and type with your statement.

    And that’s how you fix the MySQL ERROR 1054 caused by your SQL statements.

    I hope this tutorial has been useful for you

    Fix ERROR 1054 on an INSERT statement

    When you specify column names in an INSERT statement, then the error can be triggered on an INSERT statement because of a wrong column name, just like in the SELECT statement.

    First, you need to check that you have the right column names in your statement.

    Once you are sure, the next step is to look at the VALUES() you specified in the statement.

    For example, when I ran the following statement, I triggered the 1054 error:

    mysql> INSERT INTO users(username, display_name)
    -> VALUES (“jackolantern”, Jack);ERROR 1054(42S22): Unknown column ‘Jack’ in ‘field list’

    The column names above are correct, and the error itself comes from the last entry in the VALUES() function.

    The display_name column is of VARCHAR type, so MySQL expects you to insert a VARCHAR value into the column.

    But Jack is not a VARCHAR value because it’s not enclosed in a quotation mark. MySQL considers the value to be a column name.

    To fix the error above, simply add a quotation mark around the value. You can use both single quotes or double quotes as shown below:

    INSERTINTOusers(username,display_name)VALUES(“jackolantern”,’Jack’);

    Now the INSERT statement should run without any error.

    Add your solution here

     B  I  U  S smallBIGcodePlain TextASMASPASP.NETBASICBATC#C++COBOLCoffeeScriptCSSDartdbaseF#FORTRANHTMLJavaJavascriptKotlinLuaMIDLMSILObjectiveCPascalPERLPHPPowerShellPythonRazorRubyScalaShellSLNSQLSwiftT4TerminalTypeScriptVBVBScriptXMLvar <  >  & link[^]encodeuntabcaseindentoutdent

    <текстареа name="ctl00$ctl00$MC$AMC$PostEntryObj$Content$MessageText" id="ctl00_ctl00_MC_AMC_PostEntryObj_Content_MessageText" class="resizable text-editor" style="width:100%;height:250px;">

    OKPaste as

    Strip HTML
    Encode HTML
    Paste as-is
    Code block
    Quoted Text
    Best guess

    To display as

    The content must be between 30 and 50000 characters.Treat my content as plain text, not as HTML

    Fix ERROR 1054 on an ALTER TABLE statement

    The error 1054 can also happen on an ALTER TABLE statement.

    For example, the following statement tries to rename the displayname column to realname:

    ALTERTABLEusersRENAMECOLUMNdisplaynameTOrealname;

    Because there’s no displayname column name in the table, MySQL will respond with the ERROR 1054 message.

    Источники

    • https://qna.habr.com/q/268025
    • https://www.codeproject.com/Questions/1018292/unknown-column-in-field-list
    • https://sebhastian.com/mysql-error-1054-fix/
    [свернуть]
    Решите Вашу проблему!


    ×
    Adblock
    detector