enter image description here
Failed Run
You should first define what is your default Schema or Database so that your query will know where it should place the table.
in MYSQL Workspace, Double Clicking the Schema will automatically sets it up as default and ready to go.
Related
I am trying to migrate an MS Access database to MySQL Server using Workbench, but Workbench generates errors in the SQL CREATE script, which causes some tables to fail to be created. Most are of the following form:
Too-big precision 19 specified for 'TransDate'. Maximum is 6..
SQL Error: 1426
Referring to:
CREATE TABLE IF NOT EXISTS `dbName`.`tblName` (
`ID` INT(10) NOT NULL,
`TransDate` DATETIME(19) NULL,
`ClientID` INT(10) NULL,
...
As you can see, it also generates integer types with deprecated display width syntax, which is something I would like to avoid as well.
How can I make Workbench generate a script that avoids these problems?
EDIT
I am aware that the script can be manually edited in the Create Target Results stage; however there are many tables that have these errors, and I can't see any way to edit them with a text editor, so I am looking for a solution wherein Workbench generates the correct script automatically.
In the Manual Editing tab, I found an option to edit column mappings, which allows you to change multiple columns of the same type across the script all at once. Pick Column Mappings from the drop down window, and right click on a row that corresponds to the type you want to remap. Then choose 'Find and Replace Target Type' and provide the types you want to map.
I've successfully connected LibreOffice Base with MySQL data base server. I've tested if I modify my table from host (free hosting service on internet) then the changes are reflected when refreshing the table object in LO Base.
But my question is, can I modify DB table directly from LO Base? I guess that it's possible using sql queries from LO Base, but how? Please give me some insights or tutorials. Thanks.
The normal way to alter a table:
Tools -> SQL
Enter an ALTER TABLE command and press Execute button.
A way that works, even though it complains that no result set is returned:
Create a query in SQL view.
Enter ALTER TABLE command.
Click button in toolbar to mark it as Run SQL command directly. Or Edit -> Run SQL command directly.
Close the query and double-click to run it.
My guess is it could be done with a macro as well, similar to https://forum.openoffice.org/en/forum/viewtopic.php?f=5&t=75763 but using ALTER TABLE.
For more ideas see https://forum.openoffice.org/en/forum/viewtopic.php?f=61&t=37687.
EDIT:
Inserting new row data in a form is easier than altering the table. First, make sure this works:
Double-click on your table under Tables.
Insert -> Record, or enter data in the last new row.
If Insert -> Record is disabled, then you need to set up the table for editing. Make sure that your connection to the database allows editing. Also the table must have a primary key.
Once you can insert records in Table view, it's time to create the form:
Under Forms, Use Wizard to Create Form.
Select your table and press >> to include all fields.
Click Finish.
Now you should be able to open the form and enter data into the final new row.
More complete instructions with examples are at http://www.open-of-course.org/courses/mod/url/view.php?id=786.
I am developing a Ruby on Rails application that stores a lot of text in a LONGTEXT column. I noticed that when deployed to Heroku (which uses PostgreSQL) I am getting insert exceptions due to two of the column sizes being too large. Is there something special that must be done in order to get a tagged large text column type in PostgreSQL?
These were defined as "string" datatype in the Rails migration.
If you want the longtext datatype in PostgreSQL as well, just create it. A domain will do:
CREATE DOMAIN longtext AS text;
CREATE TABLE foo(bar longtext);
In PostgreSQL the required type is text. See the Character Types section of the docs.
A new migration that updates the models datatype to 'text' should do the work. Don't forget to restart the database. if you still have problems, take a look at your model with 'heroku console' and just enter the modelname.
If the db restart won't fix the problem, the only way I figured out was to reset the database with 'heroku pg:reset'. No funny way if you already have important data in your database.
I created a test database for a CakePHP tutorial I'm working through, and just used phpMyAdmin's default settings for the engine (MyISAM.) Now that I'm several days into the tutorial, it indicates that to use some of the features, the tables need to use InnoDB.
Is it possible (either in phpMyAdmin itself or via a SQL file import) to change the tables' engine choice after they've already been created? They currently have data in them, but it's only a few records each so I don't care if I have to empty the tables out. I just don't want to have to completely recreate the tables, if at all possible.
I can't seem to find any way to do this in phpMyAdmin - the only place I can find a choice of engines is when I'm creating a brand-new table.
EDITED TO ADD SCREENSHOT AFTER RUNNING QUERY:
Use this query:
ALTER TABLE my_table ENGINE = InnoDB;
where "my_table" is your table name.
In phpMyAdmin, navigate to the table and click the "SQL" tab at the top. Then paste the above query and click "Go/Execute".
I've created and edited a couple of tables and don't want to recreate them from scratch if the database gets erased. What command allows me to "export" the field names and settings (NOT the content) as a ready to use MYSQL command that I can paste back on the MYSQL prompt?
SHOW CREATE TABLE tablename;
Reference: mySQL docs