I have created table in there I choosed a column to be unique AND now I want that column to be common not unique in phpmyadmin. I could not found any option like that. How can i do that ?
Can anyone tell me how to do this
I found this on the w3c tutorial website:
ALTER TABLE Persons
DROP INDEX UC_Person;
I tried on a table with unique contraint. It worked for the email column but not the username column. Here's the link.
https://www.w3schools.com/sql/sql_unique.asp
Good luck hope it is what you need.
Related
I have a table in my database, but when I want to change something with double click option phpMyAdmin keeps printing this error:
"This table does not contain a unique column. Features related to the
grid edit, checkbox, Edit, Copy and Delete links may not work after
saving."
But there is unique column(id) and primary column(id) as you can see in my picture below.
It is really confusing, because I don't know what is the problem.
Thank you.
I created a FULLTEXT index on a table in a MySql database, and left out a column when I did so. I have been trying to figure out how to add this column so that it can be searched against along with the other columns in this table that have already been indexed.
I have searched SO and the web, but am not getting anywhere. I tried going into phpMyAdmin, and when you click on the table and then look at the structure, all the way on the right there is a dropdown that says "More." This has a "Fulltext" option that seems to add fulltext indexing to the column, so I did this, but it is still not allowing me to search the column.
Did I add FULLTEXT to this column? Either way, how do I get this to work?
For SQL Server users, it can be done like this:
ALTER FULLTEXT INDEX ON [table_name] ADD ([column_name])
ALTER TABLE foo DROP FULLTEXT old_ft_index_name, ADD FULLTEXT(this, that);
i am creating plugin in wordpress for contact us form and in that i am creating fields(textbox,textarea etc...) dynamically based on my requirement. so there is no fixed number of fields. i am storing dynamically created fields in my db table.
in some project i may require to create 3 fields and some project i may require to create 5 fields.. my dynamic form is working fine...
now my problem is DB. how do i create table to store contact us data? bcz sometimes there might be 3 fields and sometime there might be more than or less than 3 fields..
so my question is how do i make my table schema for this scenario...
suggestion will be highly appreciated...
Thanks in advnce
Change table structure is strongly not suggested, it's bad in performance, and may lost data if you drop a column.
So, the original subject 'make db table field dynamic' is possible but not a good plan, we still have alternative plan:
Store dynamic field in one table column
Find a way to combine your dynamic field to a string, either use a separator, or use json_encode works, if the column is long enough (TEXT --> MEDIUMTEXT), you can have unlimit dynamic field.
Create enough column at beginning
Apearently this not as good as upper plan, but it's easier to understand, and search in these column is easier too.
BTW, Have you considered convert these dynamic column to rows ?
You need to store the information taken from the form in one table field using an array. That way it should not matter how many question there are.
Should be quite simple take a look at php arrays.
You can have a single longtext datatype column in your database table and you just need to serialize your form values and store in the single column.
I agree with the others. Dynamically creating database tables is bad. The database schema should hardly ever change once a project is complete.
One solution is:
If you had a contact with multiple addresses, you create a parent/child relationship as follows. Perhaps you can do something similiar with your situation.
Contact
long contactID primary key
name
addressID
Address
long addressID primary key
long contactID foreign key
streetAddress
CityID
CountryID
i don't think so it's a good idea to do like this... but i am suggesting you this because in your case it might be useful
you can do it by ALTER...
so what you can do is "When you are creating new field dynamically at that time only you can create new column in your table like this...
ALTER TABLE table_name ADD $name(Column name) //$name may be your attribute name <input name="">
and same way when you are deleting your field at that time you can drop your table column
ALTER TABLE table_name DROP $name(Column name) //$name may be your attribute name
here i assumed that you have already created table table_name (without any fields)
hope it may help you
Whenever I try to insert a new record in my MySQL database using phpMyAdmin, if the column refers to a foreign key, i get a dropdown box with the valid IDs that i can use. The problem is when the database gets too big, the ID is meaningless for me. For example if the ID is the social security number of the employee, i don't know it, but i can probably remember the name. Is there a way to display the row contents next to the ID or at least one column that could be more meaningful to the user? I have seen that feature in phpPgAdmin.
I tried this in the config file:
$cfg['ForeignKeyDropdownOrder'] = array( 'content-id', 'id-content' );
But it didn't work.
phpMyAdmin has a function for this, but you must be using the InnoDB table type. You must also have pmadb configured.
Select the table that contains the foreign key (child).
Click the "Structure" tab.
Click "Relation view".
Under the foreign key constraints, click the "Choose column to display" drop down and make a choice.
The column value will now be shown next to the id. It will also be shown when hovering over the foreign key value after making a selection.
For anyone having trouble getting this setup, please see the #relation-view documentation which tells you exactly how to configure it with screenshots.
In addition to what #EternalHour says you also need to check the radio button under view options
that says "Relational display column" if you want the value to be displayed.
If not checked you will only see the Foreign Key value when you hover that specific id.
If you really want to keep using phpmyadmin for this, you can create a view with a join which shows you the name, id and other information in 1 table. Then you can just use the search function to search on a name.
First I don't know what a good title for this question
Example
On postid and wordid I can click and it will go to another table.
I want to know what code to make data in phpmyadmin can be click and link to related table?
that are just foreign keys and will let you know which table has this key so that it will be easy for end user (developer) to know yes this field has the relationship with this field of this table.
If you don't use innoDB, you'll have to use the database designer tool in phpmyadmin to set the relations between your tables. After that, you will be able to click on foreign keys as you want.
Please show other table views. postid looks like the Primary key and wordid comes from another table.
This is a basic sql join here: http://en.wikipedia.org/wiki/Join_%28SQL%29