mysql:管理数据的软件
mysqld.exe:服务器端
mysql.exe:客户端
sql:structured query language 结构化查询语言 分为三个部分 dml ddl dcl
dml:数据操作语言 处理数据
ddl :数据定义语言 定义和管理数据库
dcl:数据控制语言 授予或者回收访问数据库的特权 对数据库监视
insert into user(uid,name,age)values(1,'liming',22),(2,"ni cheng",21); 插入必是一整行
delete from user where uid=2; 删除必是一整行
update user set name='wangrui',age=21 where uid=4;
select uid from user where uid>=10;
select查询模型 where是表达式 值为真假 列是变量 列可以计算
select uid from user where 1; // 1为真 取出所有行
select uid from user where uid in(4,10); in在某集合中 相当于or
select uid from user where uid between 4 and 10; and在某范围中 相当于 and
select uid from user where uid not in(4,10);
模糊查询 like select uid from user where name like ‘li%’; %代表任意字符
select uid from user where name like ‘l___’ _代表一个字符 单一字符
update user set uid=floor(uid/10)*10 where uid between 20 and 30;
对查询结果集进行运算
select uid ,concat('test',substring(name,2)) from user where name like 'li%';