• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to update SQL databse table

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to update all the datas of one of the column of a table in my SQL database. I am using cpanel tool to manage/keep a track of my database.I exported the data in an excel sheet/CVS and have already modified it .How do I import the sheet back into that table such that it updates just that column.
I have to manage my site.Kindly let me know asap.

Thanx
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not really a JDBC question, however: what database do you use? Can't you just use SQL directly to update you data? Why do you export your data first?
 
sunita shaw
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to update my column say(phone-number) for all the cusomers.How can i change all the phone numbers by running just one query.So I exported it in the form of an excel/cvs sheet & then easily modified the column & now how do i import it back so that just that column is modified.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fair enough - you can't do that with just one statement (unless you are changing every 'phone number to be the same). Obviously, you could do it with a bunch of SQL statements though.

I still can't help much more though, unless you tell us which database you are using.
 
sunita shaw
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx Peter for ur immediate reply..Okay can u help me out with this...

what is the query to update a column of a table by 5%
e.g:
Tablename roduct
Column name : Sale

So now I want to update Sale column by 5% so there is a query to do that.
Kindly let me know as I am getting error with this one:

UPDATE table Product SET Sale = ((Sale * 5)/100);
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by sunita shaw:
So now I want to update Sale column by 5% so there is a query to do that.
Kindly let me know as I am getting error with this one:

UPDATE table Product SET Sale = ((Sale * 5)/100);


Remove the word "table". This is really an SQL question, that doesn't have anything to do with Java or JDBC. You'd better ask this to an SQL expert instead of on a Java forum.

Your SQL statement is going to set the value of column Sale to 5% of the original value, for all rows. Is that really what you want? Or did you want to increase the Sale values by 5% (i.e., set the value to 105% of the original value)?

UPDATE Product SET Sale = ((Sale * 105)/100);
[ December 01, 2005: Message edited by: Jesper de Jong ]
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that it is perfectly fine to ask SQL questions here. It's even in the forum description! Some people have gotten answers to complex SQL questions in this forum recently.
 
Dinner will be steamed monkey heads with a side of tiny ads.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic