标签:from run str bsp userinfo rename trunc 条件 inf
mysql学习笔记
增:insert 删: delete 改:update 查:select
数据库:
创建:create database `数据库名`;
修改:rename database `数据库名` to `数据库名`
删除: drop database `数据库名`;
表:
创建:create table `数据库名`.`表名` (`字段1`,`字段2`,`字段3`);
修改:rename table `数据库名`.`旧表名` to `数据库名`.`新表名`
删除:drop table `表名`
清空:truncate table `表名`
数据:
多条件用and连接, *代表所有;
增:insert into `表名` (`字段1`,`字段2`,`字段3`) value (‘值1’,‘值2’,‘值3’), (‘值1’,‘值2’,‘值3’);
删:delete from `表名` where `字段` = 条件;
改:update `表名` set `字段` = ‘新值’ where `表名`.`字段` = 条件;
查:select * from `表名` where `字段` = 条件;
变量的拼接:
变量外面用大括号;
例:$name = ‘阿‘;
$sql = "insert into `userInfor` (`userId`, `userName`, `passWord`, `vipGrade`) values (null, ‘{$name}‘, ‘123456‘, ‘1‘)";
标签:from run str bsp userinfo rename trunc 条件 inf
原文地址:http://www.cnblogs.com/wangyihong/p/7677038.html