Why mysql shows foreign key values twice - mysql

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.

Related

MySQL read only the table has no unique row identifier (primary key or a NOT NULL unique index)

MySQL 5.7
I know squat about databases but I do have a custom program that uses the databases I have. If I want to use another account (twitter) with my program, I need to make all the datasets. I've done this a few times before. It always takes me a while to figure out, but I get there.
Yet this time I'm stuck with a read-only dataset.
What I usually do is I make a new schema with a proper name.
I then go to one of my other schemas, export what I need ('sources' and 'entries') and import them to my newly made schema.
That should work and it looked like it worked again this time. BUT there is a difference... It's read-only and I am way to green to tackle this on my own. I'll try to investigate a bit more myself, but some help sure would be appreciated : ) The warning is: "read only: the table has no unique row identifier (primary key or a NOT NULL unique index)": I couldn't find any results with this exact warning so I thought to post it here :)
Thank you!
Devvie
See my comments above on how to solve it.
TL;DL - if you are stuck with a read only schema after importing your data, you might want to tick the correct checkboxes for your schemas. Select schema, select Wrench Icon and match the table to be the same as the schema's table you imported from.
Thank you all.

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

In phpMyAdmin, constraints cause weird dropdowns when editing or inserting

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:

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