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 look 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.
Related
Im getting confused on this day fixing the database for having the consistent field name.
When i want to name the field to explain: the name of the one who locked, or hidden the post.
What's the field should i use?
locked_by_username , lock_by_username or lock_username
hidden_by_username , hide_by_username or hidden_username ?
Present tense or past tense? and should i use by inside the field name, does it a bad practice?
I see many database use post_username or poster_username to describe the username of the one who posted the post.
But with lock and hide verb, i can't see any the good way for describing it.
Sorry, i know this is a really stupid question, but English isn't my native language.
Whether your native language is Kiswahili or Klingon or English, what you want here are column names that describe current state. For example username_holding_lock means the column contains the name of a user holding a lock on the row.
Somebody using a tool to troubleshoot by doing SELECT * will then be able to guess what's up when the value TomSawyer appears on some row.
I think this is more opinion based but I generally would use camel case.
I personally would use:
HiddenByUsername
LockedByUsername
A good idea might be to look at some of the Microsoft sample DB's.
A example would be the AdventureWorksDB or you can look here
http://codeplex.com/SqlServerSamples
I have never used PHP myAdmin before so I don't know why I am having the troubles that I am. I am trying to create a database, but when I hit "Save" an alert pops up saying, "This is not a number!" and then it won't let me do anything. I am not sure why I am getting this message and I am not sure how to fix it. Here is what I am seeing:
I only need a database with an id, a last name, and a first name. So I am confused on what all to put in some of these other fields. For instance, do I need anything in "Length/Values" or do I need to make "Default" something else? As far as Collation goes I have no idea what to put in there (if I do need to put something in there). I have completely no idea what "Browser transformation" and "Transformation options" are for. We never talked about this. For id I set it to primary so that way no id's will ever be the same. But other than that, I don't know what to do. Any help?
I suppose it wants you to define length values for the VARCHAR fields (names)
I am flummoxed that no one seems to have ever asked this question, which indicates that the question itself is flawed. But, I don't know how to find out the right question, or answer, other than asking, so here goes:
I'm trying out a couple of tools to connect to MySQL databases and view and edit the data. So far I've tried MySQL Workbench and Database Browser. MySQL Workbench seems to be much more robust and lets you set up foreign keys without having to write any SQL.
The problem, though, is that when inserting and updating data in columns that are foreign keys, I have to manually enter the numeric id of the parent row, and once entered, I have to manually look up which record that number refers to if I want to know. Is there no way to set a display field in the parent table and then be able to choose a value off a dropdown menu when editing the child table? phpMyAdmin does this. I'm perplexed that, not only can't I find a way to achieve this in any non-web-based database tool (I've tried Access before, too), but that no one seems ever to have needed to do it before. Am I completely thinking about this wrong? Do people not use these tools to do this type of work? Is everyone writing their own custom lookup interfaces from scratch in Qbasic? Should I memorize all the ids for my parent rows?
Or are people laughing up their sleeves at this question because it's framed so awkwardly?
SQLYog provides such functionality
https://blog.webyog.com/wp-content/uploads/2011/04/FK-Dropdown1.png
I need a sql query that will allow me to take the contents of a Wordpress custom field and insert them into the existing post (post_content). I have thousands of record that I need to do this with.
My limited SQL knowledge isnt good enough to figure this out since the the custom fields are stored in the "wp_postmeta" table and the post content is stored in the "wp_posts" table.
Thanks
You don't need to (and you most definitely don't WANT to) use SQL to do what you want.
Since you haven't actually tried anything yet, you should take a look at Update Post Meta if you want to make sure all of your tables are populated correctly, and everything is referenced properly according to Wordpress' standards.
If you run into any issues with writing the actual code to handle this, please open a new question and show us what you've tried.
Good luck.
I have added some constraints to some MySQL table fields. This seems to change phpMyAdmin a little bit, including constrained fields being presented as drop down boxes in edit or insert mode:
This looks a bit weird to me, as if phpMyAdmin wants to add titles but doesn't have the correct information. Am I correct in this assumption?
And why do the IDs go from 3 to 1, then back up to 3?
I found a solution to this. I needed to configure phpMyAdmin to display related records' titles/names.
http://thedesignspace.net/MT2archives/000043.html
Now I see that the dropdown is ordering by name, then ordering by ID: