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 15 10265
JL wrote: 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...?
update yourtablename set Goals_season=0;
JL wrote: 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...?
update yourtablename set Goals_season=0; update yourtablename set Goals_season=0;
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 update yourtablename set Goals_season=0;
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
JL wrote: update yourtablename set Goals_season=0;
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 amount of columns doesn't matter AFAIK.
500 rows is nothing, you don't even need to think about speed with that
row count.
I tested it with 20 column table, with 5000 rows. It took 0.16 seconds
to complite on my old 166MHz Pentium.
mysql> update testtable set a4=0;
Query OK, 5000 rows affected (0.16 sec)
Rows matched: 5000 Changed: 5000 Warnings: 0
JL wrote: update yourtablename set Goals_season=0;
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 amount of columns doesn't matter AFAIK.
500 rows is nothing, you don't even need to think about speed with that
row count.
I tested it with 20 column table, with 5000 rows. It took 0.16 seconds
to complite on my old 166MHz Pentium.
mysql> update testtable set a4=0;
Query OK, 5000 rows affected (0.16 sec)
Rows matched: 5000 Changed: 5000 Warnings: 0
JL wrote: 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...?
update yourtablename set Goals_season=0; update yourtablename set Goals_season=0;
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
>> 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 amount of columns doesn't matter AFAIK. 500 rows is nothing, you don't even need to think about speed with that row count.
yep speed really doesn't matter with that row count.
maybe you know this already, but another thing to mention:
if one column is a timestamp then mysql will automatically update this
column to the current date/time.
if you have multiple timestamp columns then only the first will be updated.
if you want to prevent this set the first timestamp to itself:
UPDATE `yourtablename` SET `Goals_season` = 0, `1_Timestamp_col` =
`1_Timestamp_col`;
i lost millions of rows because i oversight this in the mysql manual...
chris
>> 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 amount of columns doesn't matter AFAIK. 500 rows is nothing, you don't even need to think about speed with that row count.
yep speed really doesn't matter with that row count.
maybe you know this already, but another thing to mention:
if one column is a timestamp then mysql will automatically update this
column to the current date/time.
if you have multiple timestamp columns then only the first will be updated.
if you want to prevent this set the first timestamp to itself:
UPDATE `yourtablename` SET `Goals_season` = 0, `1_Timestamp_col` =
`1_Timestamp_col`;
i lost millions of rows because i oversight this in the mysql manual...
chris
JL wrote: update yourtablename set Goals_season=0;
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 amount of columns doesn't matter AFAIK.
500 rows is nothing, you don't even need to think about speed with that
row count.
I tested it with 20 column table, with 5000 rows. It took 0.16 seconds
to complite on my old 166MHz Pentium.
mysql> update testtable set a4=0;
Query OK, 5000 rows affected (0.16 sec)
Rows matched: 5000 Changed: 5000 Warnings: 0
Thank you for your help
Have a nice weekend.
- JL
Thank you for your help
Have a nice weekend.
- 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 amount of columns doesn't matter AFAIK. 500 rows is nothing, you don't even need to think about speed with that row count.
yep speed really doesn't matter with that row count.
maybe you know this already, but another thing to mention:
if one column is a timestamp then mysql will automatically update this
column to the current date/time.
if you have multiple timestamp columns then only the first will be updated.
if you want to prevent this set the first timestamp to itself:
UPDATE `yourtablename` SET `Goals_season` = 0, `1_Timestamp_col` =
`1_Timestamp_col`;
i lost millions of rows because i oversight this in the mysql manual...
chris
Thank you for your help
Have a nice weekend.
- JL This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: JL |
last post by:
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...
|
by: PeteCresswell |
last post by:
I'm working on a new report in an MS Access DB.
The first anomaly was a message "This action will reset the current
code in break mode." when the report was run. Seems TB something
about my...
|
by: hoenes1 |
last post by:
Hi all,
I'm trying to send files to a client following the instructions of
http://support.microsoft.com/?id=812406
Everything works fine, but if files are large and/or if the bandwidth
is...
|
by: Alex Maghen |
last post by:
Hi. Is there a way to make a call in ASP.NET that will effectively do exactly
the same thing is when you "touch"/change the web.config file? In other
words, I want to be able to programmatically...
|
by: Sanders Kaufman |
last post by:
I'm having a BLAST writing this app as OOP as PHP allows. It's one
thing to discuss the dance, but it's a thing of beauty to see the
performance.
I'm noticing that the constructor is a "reset"...
|
by: Frinavale |
last post by:
I think I'm trying to do something impossible.
I have a <div> element with a overflow style set to "scroll". In other words my <div> element allows the user to scroll the content within it.
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |