Change existing MySQL table inside NetBeans - mysql

I created a table inside NetBeans but one column is wrong type, it should be char instead of int. Is it possible to change it or do I have to delete the whole table and start again?
I searched all context menus but can't find "modify"/"edit" option.

my suggestion also you have two options :
1) By using Netbeans, you could edit (change) the current mysql table via Command Execution.
2) By using mysql ADministrator tool, such as MySQL Query Browser from mysql GUI Tool itself
Happy coding!

you can right click on the column name and select "delete option", then right click on the table name and select "add column" option.

Related

Mysql creating table issue

I started learning SQL but just in my first query, failed, i was doing exactly the same as the mentor explaining in the course but somehow his code worked mine not.
I also tried this query on PopSql it also did not work.
What is wrong here?
You need to select the database you are running this query on.
To do this via MySQL Workbench:
Click on the 'Schemas' tab highlighted below:
Then double click on the name of the database you are trying to run the query on, the database name will be bolded once selected.
You need to tell MySQL which database to use:
USE database_name;
before you create a table.
In case the database does not exist, you need to create it as:
CREATE DATABASE database_name;
followed by:
USE database_name;

Easy edit and delete row from mysql

I'm not that good at mysql but some of my tables has this line where I can edit and delete the row easy without writing any SQL? How can I make that row inside another table?
You can use any GUI editor like phpmyadmin or the tools which P.Salmon mentioned.
Using GUI editor, you can connect to the database using connection string and you can view tables and see the result which can edited and deleted.

PhpStorm : Generate a database Initialization script

When I do either these actions :
Right click on the schema / copy DDL
Compare 2 datasources / untick ignore order / click migrate left
The generated CREATE TABLE statements are alphabetically ordered.
Since there are foreign keys, I obviously get a useless script as I want to run it on an empty schema.
Is there a solution using PhpStorm or I have to use mysqldump ?
As LazyOne suggested I can't do that in phpstorm.
That would be a nice feature indeed. I can't easily report the feature request...
I therefore used a mysqldump extract.

Rearrange Column Order in Navicat

in navicat you can arrange the order of the columns but i have yet to find a way to sync the changes with the database. i saw a similar question here -> Rearrange column order in Sqlyog but haven't found anything similar in navicat. i have many tables that need to be fixed for export to excel and the order is important in the readability/presentation. typing out sql code for each move would be way too tedious. thanks in advance.
you can't do it in navicat , you have to run a sql query for that purpose
You can reorder columns using SQLyog. To change the sequence of columns in a table, select the table in the Object Browser and select Table -> More Table Operations -> Reorder Column(s) (Ctrl+Alt+R) from the popup menu.
Select any column and click Up or Down button to move the column up / down. Having re-sequenced the columns, click Re-Order to save the table with changed structure. The column data in the table gets re-arranged accordingly.
This is a really old question i Stumbled on going to answer just in case someone needs
Navicat provides the ability to change the column order in a table by using the design table feature
Either right click on the table name or press ctr-d on the top of the screen there are arrows to move a column up or down
By pressing on the SQL preview tab on the top you can actually see the ALTER TABLE statements navicat is going to run
You can also copy-paste this Statement and run on any other test database you may have or as a git migration
Its a good idea to always read the SQL Preview as some times Navicat may use DROP statements and you would want to take a backup before something like that

How to show MYSQL statements that show how to create a particular table?

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