How to set all values ​​in one MySQL Query column

I made a new tuple called "description" in the table.

Just try to set all the “description” tuples for my already created data for a specific piece of text.

eg. fundamental request for “update”, but not sure if this is the wrong method:

UPDATE suppliers SET name = 'HP'WHERE name = 'IBM'; 

Any suggestions?

+7
source share
3 answers

Sorting

I just used:

 UPDATE suppliers SET description = 'business' 

This sets all FIELDS descriptions in my table to the string "business".

Thanks for the suggestions.

+11
source

The formatting of the requested request is correct. Before running UPDATE or DELETE it is always useful to run the SELECT this query to make sure that this is the change you want to make.

Your test request:

 SELECT name FROM suppliers WHERE name = 'IBM'; 

However, the request you provide does not update the description column. For this you need something like:

 UPDATE suppliers SET description = 'HP' WHERE name = 'IBM'; 

After doing this UPDATE you can run this query to confirm your result:

 SELECT name, description FROM suppliers WHERE name = 'IBM'; 
+6
source

This will change the status of filed = "deactivate", where the table name is: - user

  Session session=null; int rows=0; try { session =HibernateUtil.getSessionFactory().openSession(); Query query = session.createQuery("UPDATE user SET status = 'deactivate'"); rows = query.executeUpdate(); // result = query.list(); } catch (HibernateException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally { session.close(); } 
0
source

All Articles