oInsert插入语句主要是用于在数据库某一张表内插入新记录
insert into table_name (column1,column2,….) values (value1,value2,….);
例如:在cq_passway表中插入一条记录:
Insert into cq_passway (id,mapid,passway_idx,passway_mapid,passway_mapportal) values (0013,1006,0000,1002,0005);
如果不需要匹配字段插入,上面一句可写为:
Insert into cq_passway values (0013,1005,0000,1002,0005);
练习
o往cq_task表的id,id_next,money,sex,team,metempsychosis字段中插入数值1000,1001,0,999,999,0
oInsert into cq_task (`id`,`id_next`,`money`,`sex`,`team`,`metempsychosis`) values (1000,1001,0,999,999,0);
o更新语句(update):
oUpdate语句主要用于更新一条数据库中已经存在的表记录的数据
o
update table_name set column1=XXX(,column2=XXX) where condition;
例如:将数据库cq_npc表中,所有type为2的npc,mapid都改成1000,lookface都改成1002
Update cq_npc set mapid=1000,lookface=1002 where type=2
练习:将数据库cq_itemtype表中所有名字带“剑”字,req_sex为1的物品,price改成0,weight改成0:
Update cq_itemtype set weight=0,price=0 where name like ‘%剑%’ and req_sex=1;
o