I have installed MySQL Workbench and I have the following problem.
I perform this simple select query:
SELECT * FROM spring_security.user;
that returns a list of rows.
So, in the output area, I select a field of a specific row and I try to change its value. But I can't do it.
Seems that is is impossible insert a new value for a specific field of a specific row.
Why? How can I use this tool to change a value?
You can do easy with MySql Workbench this way :
in menu database simply connect
then select the database you need and then the table.
Positioning the mouse over the table name in table schemas explore and so you can see on the rightside a table icon.
Selecting/clicking this icon you can see the date in tabular form (like Toad).
With this tabular form you can edit and apply the change
Applying the change MySql Workbench show you the sql code and ask for confirm
(the apply button is on the lower right corner of the table)
Leif Neland's comment on #scaisEdge's answer is the real solution (as indicated by the huge comment-upvote count), so here it is as an answer, to increase its visibility:
Given that:
your query selects from just one table (no join)
the table has a unique primary key
your DB user has permission to UPDATE
Then, in the Result Grid, you can edit a field by one of the following:
Click a field once to select it (the cursor changes into text cursor), and click a second time to start editing in-place in the Result Grid, or
Right click on a the field and select the "Open Value in Editor" option
After editing the value, you need to apply it:
The [apply] and [revert] buttons are at the lower right corner of the table.
— Leif Neland
As shown here:
Also, you can execute next script:
UPDATE table SET cell='new_value' WHERE whatever='somevalue'
This answer may be too late, but in case anyone needs it, MAKE SURE THE TABLE HAS A PK (Primary KEY) if it has a PK you will able to edit it in MySQL Workbanch
Related
I posted a couple times over the last couple of days about some trouble I'm having with an inventory database that I'm trying to make at work. I have very little experience, so have been mostly following YouTube tutorials and walk throughs online.
Essentially I have a table that will be filled with inventory information such as ID number, manufacturer, model number, etc. I then have a form that has a text box for each field in the table that the user will fill in and then an Add, Delete and Edit button that will allow them to either Add a new record by filling in the text boxes and clicking Add or select a current record in the table from a combo box or list and edit it or delete it by clicking the associated buttons.
I tried to code this first and kept getting an error for the past two days no matter how much I tried to fix it and what advice I got on here, so now I'm at the point where I'm just using queries to do it.
Right now I have a main table, temp table, the form, and then these queries:
1. delete query that will clear the temp table
2. append query that will take the records from my temp table and add them to my main table
3. append query that will take the selected record on form and add it to the temp table
4. update query that will update the fields on the main table to the data in the temp one
5. delete query that will delete the record you select on the main form from the main table
This was my plan:
for adding a new record
1. run query no.1
2. load the form
3. if OK button clicked:
4. run query no.2
for editing
1. run query no.1
2. run query no.3
2. load the form
3. if OK button clicked:
4. run query no.4
for deleting:
1. load a msgbox with the YesNo options
2. if Yes button clicked:
3. run query no.5
The one I'm having trouble with is query number 3. I've made the query correctly to the best of my knowledge, but when I fill out the form and click add it tells me the query is going to append 0 rows and then it doesn't add anything to the temp table.
I also can't seem to figure out how to take the data from the temp table and move it to the main table using the query.
I'm linking to an IMGUR post with screenshots in it here:
http://imgur.com/a/ffWge
Any ideas?
I hesitate to answer this since there are too many points to cover. Gustav already gave great advise about learning to use Access Forms like they are intended. But from the screenshots, it looks like you misunderstand something fundamental about the Access query designer. Even though you shouldn't have to write any queries for want you want to do, at some point you will need to understand how to properly design a query.
If you want the query to insert FROM the form INTO the table, then the table field references should not be in the criteria, they should be like this:
Field: [Forms]![frmInventory]![ICN]
Table: {leave blank}
Append To: ICN
Criteria: {leave blank}
Also, remove [tblInventoryTemp] from the query window since you already specified the destination table in the Append Query pop-up window. The SQL should look something like this:
INSERT INTO tblInventoryTemp ( ICN, model, serial, ... )
SELECT [Forms]![tblInventory]![ICN], [Forms]![tblInventory]![model], [Forms]![tblInventory]![serial], ...
Likewise for the other query to copy from temp to the main table. You should have already specified the destination table in the pop-up window, so remove [tblInventory] from the query window. Also remove the list of fields you have in the Criteria row. The SQL should look something like this:
INSERT INTO tblInventory ( manu, model, serial, ... )
SELECT tblInventoryTemp.manu, tblInventoryTemp.model, tblInventoryTemp.serial, ...
FROM tblInventoryTemp
Access will likely add more details, but the general form of the SQL should match what I have.
I am trying to create a report putting a field called contact which has the name of a person. This name is linked directly to another table where I keep all the contacts.
For some strange reason, when I include this name (which in query view displays as the name of the contact), instead of the name appearing, the unique ID number is shown on my report.
As mentioned in the article cited in the above comment, you can use a Combo Box control on your report to do the lookup for you. To see how this can be done, create a new report based on the table containing the lookup field, then drag and drop that field onto the report. That will create a Combo Box control with properties that look something like this:
Row Source: SELECT [Clients].[ID], [Clients].[LastName] FROM Clients;
Bound Column: 1
Column Count: 2
Column Widths: 0";1"
You could use a similar Combo Box control on your actual report to display the client's name rather than their numeric ID value.
Another alternative would be to change the Control Source of the report's Text Box control to have it do a DLookUp() on the table. If the lookup field is named [client] then changing the Control Source of the Text Box to something like
=DLookUp("LastName","Clients","ID=" & [client])
would also work.
I wanted to add to the great answer by Gord:
When using a "web" database (started in Access 2007 I think), you cannot change a report's fields to ComboBox style, nor can you use DLookUp(). (web databases lack a ton of features)
The workaround for this, if you want to create a Web-Report that uses lookup fields, is to create a Web-Query first based on your Web-Table (all the Web-* stuff has a www planet icon over the logo, if you create a new Web-DB in Access 2007+ you'll see what I mean)
So, instead of Table -> Report, you'll have to do W-Table -> W-Query -> W-Report.
Then, the only thing you need to customize to get the data right is the W-Query. Start by trying to reproduce the look in the query to match what you want users to see in the report. Note that here in the query, lookups will work fine (instead of the unique ID's, you get field names like you want). However, this will not carry over to the report. To do that, you gotta get the actual text field name you want into the query:
You should already have one table in your query; start by adding the table that your first lookup field points to. For example, the table I want to print is called Stock_Boards, and it has a lookup field called PCBID_lookup that points to the table Stock_PCBs.
Since you're using lookup fields, there should already be a relationship line between the two tables when you add the second one. If there isn't, something has gone horribly wrong.
Now, see how that line connects two fields on the two different tables? For example, I've got my PCBID_lookup field on my Stock_Boards table, which connects to the ID field on my Stock_PCBs table. If I created a report from this now, PCBID_lookup would be a number, a number that correlates to the ID of a record on Stock_PCBs.
To fix it, I will add the name field I want to show up on the report. In my example, that happens to be a Part Number, rather than the ID. I add the PartNumber field from my Stock_PCBs table to the query, and remove the PCBID_lookup field of the Stock_Boards table from my query.
Since PartNumber is what I want to show up on my report, it effectively replaces the original field (PCBID_lookup)
Repeat for all lookup fields you want in your report.
I had 1 more: I removed the Status field of the Stock_Boards table (which was an ID/Lookup) and added the 'Status' field from the Status table (which was the actual text name)
When finished, your query should look exactly how you want the data to appear, without any special tricks or asking Access to do something unnatural. Save your query, and create a web-report from it. Done!
I am using MySQL Workbench 6 CE to create some tables for a new schema I made.
When I create the new table, the application displays a tab which allows me to edit the table name (by default, the name is new_table), select the schema default, and add a comment for the table (though doing that seems to generate syntax errors in the generated SQL).
What it does not do is allow me to specify or configure any of the columns for the table. There is an entire column section that is completely greyed out.
I am logged in as root and root has all privileges for this schema.
Have I found a bug, or is there something special I need to do in order to allow column specification in a table???
Someone please advise...
UPDATE: Adding screenshot as requested...
Click on the encircled double arrow
You will now be able to edit columns. Click on any column name, grey area will become editable now.
When you started creating a new table you can simply add columns by double clicking the empty placeholder row:
I have had the same prb in MySQL Worbench 6.3.6. Here is the link to the solution.
Or just drag down your Output Panel in short !
http://bugs.mysql.com/bug.php?id=79281
You have to checked any key to enable the column name.
please check PK,NN, UQ, B etc then column are ready to edit.
Every query has a final row with an asterisk beside it and null values for every field? Why does this show up? I cant seem to find an explanation for it. Even putting a WHERE clause doesnt seem to get rid of it. Is this only happening to the MySQL implementation alone?
It is for inserting a new row, you enter the values there.
Are you sure it's not just the data entry row. Usually when viewing the table data in something like Workbench or SQLYog, it will display the rows of data, plus a blank row at the end that is used for adding new data. It will show NULL for each column if that is the default value for that columns data type
Yea, you can type the values directly when you click on the box instead of writing “insert into…” in your query tab
I have about 11 columns in a mysql table and none of them are empty. When I view these columns in the Browse section, some columns are hidden whereas I'm sure they exist.
I have updated phpMyAdmin to latest version (4.1.5) but that did not solve anything. I also exported the table, dropped it and imported it again but nothing changed.
How do I make all the columns visible?
You could look in the exported file to double-check that they exist there.
Another thing to try; from the table, click the SQL tab. The default text will probably say SELECT * FROM `tablename` WHERE 1, try running that and see if you get any different response.
If you click the Structure tab, do you see the columns that are hidden?
Do you have access to the command-line client? If so, can you test showing the table structure there to see if it's different than displayed by phpMyAdmin?
Edit: Have you tried a different browser?
Marc Delisle points out that the column may be hidden within phpMyAdmin; in the Browse tab look to the left of the column headers, there's a T with two arrows -- to the right of that is a small dropdown arrow. Make sure all your columns are selected there. It's doubtful this is the cause of your problem, because you dropped the table and recreated it, but it's the next thing to check.
Can you copy the table to another database for testing, verify that the problem exists there, then truncate the table (remove all data, see the Operations tab to do this), and see if it continues (that will help determine whether it's the structure or the data causing the problem)?
Can you try to export the structure only and recreate the problem on the demo server (log in with the username root and a blank password)? Can you post the structure here? Make sure you obscure any sensitive information if needed.
This question is a duplicate to this one:
phpMyAdmin doesn't show added columns
so here is my duplicate answer! I don't think I have enough kudos to flag this as duplicate yet.
Database phpmyadmin is used to store which columns are hidden, which column a table should be sorted by, etc etc. Table pma_table_uiprefs (phpmyadmin.pma_table_uiprefs) in particular has columns: username; db_name; table_name; and prefs.
I found the row in that table that matches your db_name,user_name and table_name, and deleted it. That reset the layout back to showing all columns!
The prefs column is text, and it's format could probably be deciphered if you have some spare time and energy, but deleting the row is easy and you can then adjust the layout again in phpmyadmin, and the row will be recreated in phpmyadmin.pma_table_uiprefs.
I was authenticated as root when doing this.
i just solved this with a relatively easy fix! (finally my time to give back :) )
For anyone reading in future, go to operations (top row, same as browse, structure etc). Then under Copy table to (database.table): just change the name of the table, press go. This will create a duplicate that should be fine.
Go to the same area of the problematic table and DROP it under Delete data or table. This will delete the table.
Now go to the operations of your new page and rename the table to the way it was. Like in the image linked.
Image of where to go in PHP Admin: