自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

MySQL多表更新示例

數(shù)據(jù)庫 MySQL
多表更新是我們經(jīng)常需要用到的功能,下文就以示例的形式為您詳細介紹多表更新的實現(xiàn)方法,希望對您能夠有所幫助。

MySQL多表更新應該如何是實現(xiàn)呢?對于很多剛接觸MySQL數(shù)據(jù)庫的新人來說,都會有這樣的疑問,下面就為您介紹MySQL多表更新的方法,供您參考。

MySQL多表更新:

  1. update contact c, contactdroit cd   
  2. set c.user_name = '$username'c.nom = '$lastname'c.prenom = '$firstname'c.passcode = '$password'cd.droit_id = '$droitid'   
  3. where c.contact_id = '$id' and c.contact_id = cd.contact_id;  

示例:

  1. mysql> create table one(id int(10), name varchar(20));  
  2. Query OK, 0 rows affected (0.03 sec)  
  3.  
  4. mysql> create table two(id int(10), name varchar(20));  
  5. Query OK, 0 rows affected (0.05 sec)  
  6.  
  7. mysql> insert one value(1, '1');  
  8. Query OK, 1 row affected (0.00 sec)  
  9.  
  10. mysql> insert two value(22, '22');  
  11. Query OK, 1 row affected (1.02 sec)  
  12.  
  13. mysql> update one o, two t set o.name='oo't.name='tt';  
  14. Query OK, 2 rows affected (0.00 sec)  
  15. Rows matched: 2 Changed: 2 Warnings: 0  
  16.  
  17. mysql> select * from one;  
  18. +------+------+  
  19. | id   | name |  
  20. +------+------+  
  21. |    1 | oo   |  
  22. +------+------+  
  23. 1 row in set (0.00 sec)  
  24.  
  25. mysql> select * from two;  
  26. +------+------+  
  27. | id   | name |  
  28. +------+------+  
  29. |   22 | tt   |  
  30. +------+------+  
  31. 1 row in set (0.00 sec)  
  32.  

 

 

 

 

【編輯推薦】

Mysql多表查詢的實現(xiàn)

Mysql臨時表的用法

拆表用的MySQL存儲過程

深入探討MySQL鎖機制

單表多字段MySQL模糊查詢的實現(xiàn)

責任編輯:段燃 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2010-11-22 15:34:17

MySQL多表更新

2010-11-23 11:44:10

MySQL多表聯(lián)合查詢

2010-04-12 17:47:01

Oracle多表查詢

2010-09-27 10:29:14

sql update語

2010-04-08 17:40:02

Oracle 多表關(guān)聯(lián)

2010-09-17 10:39:36

SQL中

2010-11-23 14:40:04

MySQL多表刪除

2010-10-15 15:02:37

Mysql多表刪除

2010-11-22 15:56:34

Mysql多表查詢

2010-10-14 14:28:03

Mysql多表查詢

2010-09-13 09:23:28

SQL中多表刪除

2023-11-14 09:08:12

MySQL多表關(guān)聯(lián)

2012-07-06 09:00:34

MySQL

2010-11-23 16:35:59

MySQL刪除多表數(shù)據(jù)

2010-05-27 15:18:47

MySQL連接

2022-04-01 11:14:48

MySQLJava索引

2010-11-22 16:05:53

MySQL多表插入

2015-07-13 14:05:32

ios開發(fā)多表視圖

2015-07-06 10:48:56

iOS開發(fā)技巧

2010-11-23 15:12:03

MySQL授權(quán)表
點贊
收藏

51CTO技術(shù)棧公眾號