开发者

What is 'comments' field in MySQL phpMyAdmin when creating a table?

开发者 https://www.devze.com 2023-04-05 17:12 出处:网络
I have wondered this for many years and every time I did a search it was totally unrelated to what I am looking for as it thought I was searching for \"how to comment out data\".When you create a new

I have wondered this for many years and every time I did a search it was totally unrelated to what I am looking for as it thought I was searching for "how to comment out data". When you create a new DB table in phpmyadmin, there is a comments field there. What the heck is that for? :) I assumed it allowed you to leave notes on that field or something, but I tried to enter data in that field once and lo开发者_如何学Pythonok around that table and didn't see anything. Please let me know what its purpose is. Thank you :)


Its simply just a comment so if you need to go back to that column and remember why/how you created it, you can reference it.

For Example: storeHeadID : int, comment: "This is the ID of the store's head office"


Once you added a comment in the comment field for a column, you should see a dotted underline under that column name in the table's structure view. If you mouse-over that underline you will see your comment as a tooltip. It is very handy to keep track of what the different values in the column mean eg. "status 0:disabled, 1:active, 2:suspended etc."


It's a comment field that describes the column. Although optional, some gui data browser applications format the comment field nicely at the top of the column. I think even good old PhpMyAdmin handles that if I recall correctly. Hope that clears it up for you.

Happy coding.


Your assumption was right, you can describe a column with plain text in any way you want – its purpose, its meaning, its side effects, for later, for others, for user comfort, for completion's sake.

If you're using phpMyAdmin though, take note that this feature was implemented no sooner than in version 2.6.4.

Release notes

Improvements

  • Display column comments while editing data

In older versions of phpMyAdmin that text (or even the field) doesn't show up at all, even though you can set a comment via inline coding.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号