1.insert语句
###property_name和property_value需要一一对应###
insert [into] $table_name ($property_name_1,$property_name_2,...) values($property_value_1, $property_value_2,...);
###insert还有一种简写方式,但该方式后面的参数体需严格对应该表中的字段的顺序和个数###
insert [into] $table_name values($proerty_value_1,$property_value_2,...);
###查询特定格式的字符编码方式###
show variables like 'character%';
注意:如果插入的字段值中含有了中文,可能会出现乱码问题。可以在mysql的安装根目录下找到my.ini,将client中的参数default-character-set设置为gbk。
2.update语句
###更新表中所有记录的某个字段的值###
update $table_name set $property_name=$property_value;
###根据args条件判断更改相应记录字段的值###
update $table_name set $property_name1=$property_value1,$property_name2=$property_value2... where $args_name=$args_value;
3.delete语句
###根据args条件判断删除表中对应的记录###
delete from $table_name where $args_name=$args_value;
###删除整张表###
delete from $table_name;
###另一种删除整张表的方式,这种方式的实现方式是将原来的表文件删掉,然后创建一张同样的空表###
truncate $table_nama;