Is name a reserved word in MySQL?

后端 未结 6 1527
傲寒
傲寒 2021-01-18 12:38

Can I name a column name in my mysql tables?

6条回答
  •  执念已碎
    2021-01-18 12:58

    Just a word of caution here. As field name name is fine.

    However in stored procedures name as variable does something else.

    Consider the following procedure. When I called this procedure it always would alter the first record in my config database. Once I renamed the variable named name to something else, things worked fine.

    PROCEDURE `updateConfig`(IN name VARCHAR(255), IN val VARCHAR(255))
    BEGIN
    UPDATE LOW_PRIORITY `config`
      SET `value`=val
      WHERE `name` = name
      LIMIT 1;
    END
    

提交回复
热议问题