Community
Showing results for 
Search instead for 
Do you mean 
Reply

How to rename a field!!

New Member
Posts: 1
Country: USA

How to rename a field!!

Act! Version 6.0.30979

Data base housed on Microsoft One Drive (cloud)

Windows 7 Ultimate

 

How can I rename a field? I have clicked on TOOLS but can't find "DEFINE FIELDS"

Platinum Elite Contributor
Posts: 14,854
Country: Australia

Re: How to rename a field!!

I think it was under the Edit menu in 6.0

BTW: Storing the db in One Drive is a bad idea...
New Member
Posts: 4
Country: USA

Re: How to rename a field!!

GreatPeople is the employee communication website for Kroger’s. Kroger or The greatpeople.me Kroger Company is the biggest retail chain in the United States by revenue. They are the second-largest retail service in terms of stores. The company is the 4th largest private employer and has a vast market reach.

New Member
Posts: 2
Country: USA

Re: How to rename a field!!

Renaming a column in MySQL involves using the ALTER TABLE command. For MySQL version 5.6 .x and 5.7.x, the typical syntax is as follows:

ALTER TABLE table_name CHANGE old_column_name new_column_name <column definition>;
ALTER TABLE products CHANGE product_name product_full_name VARCHAR(100) NOT NULL;

Note that you MUST restate the full column definition, otherwise undeclared attributes will go back to default. For example, not stating NOT NULL will result in the column allowing NULLS.

To ensure that you do not miss anything, you can use the SHOW CREATE TABLE command to see the full column definition:

mysql> SHOW CREATE TABLE products\G*************************** 1. row ***************************       Table: productsCreate Table: CREATE TABLE `products` (  `product_id` bigint(20) NOT NULL,  `product_name` varchar(100) NOT NULL,
(The rest of the output is truncated for brevity)

Then use that as basis for the ALTER TABLE command.

 

While MySQL 8.0 accepts the above syntax, it also support an easier way:

ALTER TABLE products RENAME COLUMN product_name TO product_full_name;

This is a lot easier since there's no longer a need to restate the full column definition. But if you need to change both the column name and something in the definition, you can use the ALTER TABLE ... CHANGE command to do it in one go 

 

New Member
Posts: 1
Country: USA

Re: How to rename a field!!

[ Edited ]

I'm happy to see the issue is now solved. Thank you for updating us with the outcome.

 

 

mygroundbiz