标签:表名 style ima 就会 innodb arch class value ble
1 CREATE DATABASE mahaiwuji; 2 USE mahaiwuji; 3 ? 4 CREATE TABLE emp 5 ( 6 empno INT PRIMARY KEY, 7 ename VARCHAR(10), 8 sal INT 9 ) ENGINE = INNODB DEFAULT CHARSET = utf8; 10 ? 11 INSERT INTO emp VALUES (1,‘smith‘,2800); 12 INSERT INTO emp VALUES (2,‘allen‘,1500); 13 INSERT INTO emp VALUES (3,‘ward‘,3500); 14 INSERT INTO emp VALUES (4,‘jones‘,1300); 15 INSERT INTO emp VALUES (5,‘martin‘,1600); 16 INSERT INTO emp VALUES (6,‘blake‘,3000);
INSERT [INTO] 数据表名 [(字段列表)] {VALUES | VALUE} (字段列表) ON DUPLICATE KEY UPDATE 字段名1 = 新值1[,字段名2 = 新值2] …;
1 INSERT INTO emp (empno,ename,sal) VALUES (2,‘allen2‘,3000) 2 ON DUPLICATE KEY UPDATE ename = ‘allen2‘,sal = 3000;
REPLACE [INTO] 数据表名 [(字段列表)] {VALUES | VALUE} (值列表) [, (值列表)] …;
1 REPLACE INTO emp (empno,ename,sal) VALUES (3,‘ward2‘,3600);
REPLACE语句与INSERT语句的使用类似,区别在于前者每执行一次就会发生两个操作(删除记录和插入记录)。
标签:表名 style ima 就会 innodb arch class value ble
原文地址:https://www.cnblogs.com/mahaiwuji/p/12633614.html