put mysql temporary field (virtual field)

Asked 2 years ago, Updated 2 years ago, 40 views

Hi, everyone.


+-------+---------+
| | Field |count    |
+-------+---------+
| test | 4 | <- Fields in Table 
+-------+---------+
| etc | 2 | <- Temporary field of fields not in table.
+-------+---------+

I'd like to temporarily put a field that wasn't in mysql table like this. How should I do it?

mysql php

2022-09-21 18:05

1 Answers

You're going to add a field that didn't exist? But what is the case of temporarily putting in a field? Once the data is stacked on the table, you have to migrate it when the table structure changes later, so you have to change the structure carefully. I wonder what the temporary field is for.

Once you add a column to the table, you can use Alter table.

ALTER TABLE table_name
ADD column_name datatype


2022-09-21 18:05

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.