标签:rename -- 记录 order by cat book col pre update
create database 数据库名;
use 数据库名;
show databases ;
drop database 数据库表名;
create table table_name(列名1 属性,列名2 属性...);
show columns from 数据库名.数据表明;
或者
describe 数据表名;
describe 数据表名 列名;
alert table 数据表名 alert_spec;
rename table 数据表名1 to 数据表名2;
drop table 数据表名;
或者
drop table if exists 数据表名;
insert into 数据表名(column_name,column_name2,...) value (value1,value2,...);
insert into 数据表名(value1,value2,...);
select select_list from 数据表名 where condition;
update 数据表名 set column_name1 = new_value1,column_name2 =new_value2 where condition;
delete from 数据表名 where condition;
select select_list -- 要查询的内容,选择那些列
from 数据表名 -- 指定数据表
where primary_constraint -- 查询时需要满足的条件
group by grouping_columns -- 如何对结果进行分组
order by sorting_cloumns -- 如何对结果进行排序
having secondary_constraint -- 查询时满足的第二条件
select*from tb_mrbook; //查询数据表中所有数据
select id,bookname from tb_mrbook; //查询数据表中id和bookname列的数据
select tb_mrbook.id,tb_mrbook.bookname,auther,price from tb_mrbook,tb_bookinfo where tb_mrbook.bookname=tb_bookinfo.bookname and tb_bookinfo.bookname = ‘水浒‘;
select * from tb_mrbook where bookname like "%php%";
select id,concat(bookname,":",price) as info from tb_mrbook;
select * from tb_mrbook limit 2,6;
avg 平均值 count 统计 min 获取最小 max 获取最大 sum 获取所有总和
select sum(price) as totalprice from tb_mrbook;
select type1,avg(price) as type2 from tb_mrbook group by type1;
select type1,avg(price) as type2 from tb_mrbook group by type1 having avg(price)>60;
标签:rename -- 记录 order by cat book col pre update
原文地址:https://www.cnblogs.com/heanwanfeng/p/13294039.html