简单的“重置”方式整列中的数据为默认值? [英] Easy way to "reset" data in whole columns to default value?

查看:70
本文介绍了简单的“重置”方式整列中的数据为默认值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我有一个包含以下条目的数据库:


Id,Name,Goals_season,Goals_total

----------------------------------------

5, John,5,23

6,Mike,2,14

7,Joe,10,34

每个季节我们必须重置Goals_season列到默认值

(0),但不是其他列...

最简单的方法是什么?我应该简单地删除该列并且

创建一个新列,或者......?

(我希望我的问题不要愚蠢 - 它已被删除我工作了一年

mysql)

最好的问候

JL

Hi there
I have a database with entries like the following:

Id, Name, Goals_season, Goals_total
----------------------------------------
5, John, 5, 23
6, Mike, 2, 14
7, Joe, 10, 34

Every season we have to reset the "Goals_season" column to the default value
(0), but not the other columns...
What is the easiest way to do this? Should I simply delete the column and
create a new column, or...?
(I hope my question isn''t to stupid - it''s been a year since I worked with
mysql)
Best regards
JL

推荐答案

JL写道:
JL wrote:
你好
我有一个数据库,其中包含以下条目:

我,姓名,Goals_season ,Goals_total
----------------------------------------
5,John,5,23
6,Mike,2,14
7,Joe,10,34

每个赛季我们都必须重置Goals_season。列为默认值
(0),但不是其他列...
最简单的方法是什么?我应该简单地删除列并创建一个新列,或者......?
Hi there
I have a database with entries like the following:

Id, Name, Goals_season, Goals_total
----------------------------------------
5, John, 5, 23
6, Mike, 2, 14
7, Joe, 10, 34

Every season we have to reset the "Goals_season" column to the default value
(0), but not the other columns...
What is the easiest way to do this? Should I simply delete the column and
create a new column, or...?




更新yourtablename设置Goals_season = 0;



update yourtablename set Goals_season=0;


JL写道:
JL wrote:
您好
我有一个数据库,其中包含如下条目:

我,姓名,Goals_season,Goals_total
---------------------------------------- < 5,John,5,23
6,Mike,2,14
7,Joe,10,34

每个赛季我们都要重置Goals_season ;列为默认值
(0),但不是其他列...
最简单的方法是什么?我应该简单地删除列并创建一个新列,或者......?
Hi there
I have a database with entries like the following:

Id, Name, Goals_season, Goals_total
----------------------------------------
5, John, 5, 23
6, Mike, 2, 14
7, Joe, 10, 34

Every season we have to reset the "Goals_season" column to the default value
(0), but not the other columns...
What is the easiest way to do this? Should I simply delete the column and
create a new column, or...?




更新yourtablename设置Goals_season = 0;



update yourtablename set Goals_season=0;




更新yourtablename设置Goals_season = 0;

update yourtablename set Goals_season=0;




谢谢你你的回复。

如果表中包含20列x

500+行,那么更新是一种很好的(有效的)方法......需要更新吗?

(我提出的表格是简化的,它实际上包含20列,

需要设置为0 ......)

干杯

JL



Thanks for your reply.
Is update a good (efficient) way to do it if the table contains 20 columns x
500+ rows... that needs to be updated?
(the table I presented was simplified, it actually contains 20 columns that
needs to be set to 0...)
Cheers
JL


这篇关于简单的“重置”方式整列中的数据为默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆