In phpMyAdmin, constraints cause weird dropdowns when editing or inserting - mysql

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:

Related

Why mysql shows foreign key values twice

I am trying to make etiquette system for my blog. I have created 3 tables for etiquette system. These are etiquetee, content and content_etiquette(there is relation between content and etiquette). I have tried to set many to many relation between content and etiquettes. There is no problem when I add query to content_etiquette table. But I see values as twice while add attributes on phpmyadmin panel. I have wondered its cause. Is there anyone who know?
This is a feature so that you can start typing either the key or the value in the dropdown. The behavior is configurable, see https://docs.phpmyadmin.net/en/latest/config.html#cfg_ForeignKeyDropdownOrder.

MySQL Foreign Key Lookup in Editor

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

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

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.

Bizarre behavior in MS Access

I have defined three tables, Stores, InventoryItems and StoreItemRecords. My StoreItemRecords table has foreign key columns (StoreID, InventoryItemID) that "point to" the primary keys of the Stores (StoreID) and InventoryItems (InventoryItemID) records. The columns are named the same between the tables.
If I run a query like this:
SELECT StoreID, InventoryItemID FROM StoreItemRecords;
I get some bizarre results. I get:
1, Hammer
2, Box of Nails
3, Some other item name.
So, I am getting the StoreID, as I should. But I am also getting the NAME of the inventory item, not the ID of the inventory item. Also, it is important to note that the InventoryItemID column is defined as a NUMBER, not TEXT.
So somehow, Access is trying to help me by providing the InventoryItemName in place of the InventoryItemID, but I can't seem to find the cause of this behavior or any way to stop it.
[one more note. I have written some VBA code to populate the StoreItemRecords table and, in debug mode, I can "watch" the InventoryItemID values being assigned to the column, and I have verified that the IDs are actually being put in there.]
Has anyone seen behavior like this? I know I am going to feel really dumb when someone points out the goofy thing I am doing to cause this but, at this point, it is worth the embarrassment.
Thanks in advance for any help you can provide.
My money is on one of the fields being setup as a “lookup table” in access. These are generally considered to be a not so useful feature of access trying to help novice developers who find it hard to grasp how a database works.
If you go into the table in design mode you should be able to verify if that is set on the fields in question. If it is turn it off and try the query again
Here is a link on why they are evil
http://www.mvps.org/access/lookupfields.htm

ms access can't edit field because I must delete relationships but there are no relationships to delete

I have built a database on multiple tables. One of these tables has a field (Initials) that was originally defined to have 50 characters. After building the entire thing I realize I would have liked that field to be limited to 3 characters. I tried to change this, but it tells me that I have to delete one or more relationships. So, I open up the relationship window and delete the one relationship that is attached to this field, expecting that I should be able to go back and change the character limit then go back and add the relationship again. So, as of now there are ABSOLUTELY NO relationships touching Initials in the relationships window. I go back to change the char limit and it gives me the same error. I can't even delete Initials and recreate it because of the same error. I went through my entire project and took that field out wherever it appeared. Still, same error. Any ideas?
Per Matt,
apparently when you display a field in a report it does not show up in the relationships >window. I deleted it from the report, edited the char limit, then put it back in the >project. of course, right when i resort to the forum i figure it out. thanks to those who >helped