my friend wants from me to write two queries for him but really I don't know ,would you please help me? also ther开发者_开发百科e is a table with two column (String Telephone and BIGIN Charge). the sentences that I want to write a query for that:
one: Reduce the “Charge” for all Telephone numbers starting with ‘123’ by 30. two: Update all the Telephone numbers in the table by adding a ‘02’ in front of it.
thanks.
** I use MySQL**
Something like this:
select charge - 30 from YourTable where Telephone like '123%'
or
update YourTable set charge = charge - 30 where Telephone like '123%'
I'm in doubt whether reduce means update or select so I have added both.
update YourTable set Telephone = '02' + Telephone
Hope it helps
You get the null pointer exception because stmt
is null. Typically, you have to create stmt
by using conn.createStatement()
. conn is the java.sql.Connection
object.
精彩评论