mysql sql语句
终端启动命令:mysql –u用户名 [–h主机名或者IP地址] –p密码
查看表定义:desc tablename
修改表定义:alter table tablename modify/add/drop/change/rename cloumnname [newcoumnname][defination] [first/after cloumnname] (change改字段名,rename改表名)
更新数据:update tablename set cloumnname= [where condition]
删除数据:delete from tablename [where condition]
查询数据:select distinct * from 去重复
排序: order by field1 [DESC|ASC], field2 [DESC|ASC];
左/右连接:select field1… from table1 left/right join table2 on condition;
子查询:select…in(select…) #in内只能包含一个字段
记录联合:union all;union