1、删除表:DROP TABLE score ——score 为数据表的一张表;
2、更新一条数据:UPDATE tb_goods SET tg_desp='用起来非常好' WHERE tg_id=1;
3、插入一条数据:INSERT INTO tb_goods_cata (tgc_id,tgc_name,tgc_father_id,tgc_status) VALUES ('2','商品分类2','0','1')
——其中(tgc_id,tgc_name,tgc_father_id,tgc_status) 可省略
4、简单查询语句:select tsf_sku_id from tb_sales_fitting where tsf_sku_id=200;
5、删除语句:delete from tb_order where to_id=2;
6、综合查询(包括拼接、模糊查询,升序排列,取前几位):SELECT tp_id,tp_pc_id,CONCAT(tp_name,\ FROM tb_product WHERE tp_name LIKE '%水管%'ORDER BY tp_pc_id ASC LIMIT 8
统计次数(count):SELECT tsa_product_id,tp_sample_name,COUNT(tsa_product_id)times FROM tb_sales_agent,tb_product WHERE tsa_product_id=tp_id GROUP BY tsa_product_id ORDER BY times ASC ——ASC:升序;DESC:降序
7、left join(左联接): 返回包括左表中的所有记录和右表中联结字段相等的记录 8、right join(右联接): 返回包括右表中的所有记录和左表中联结字段相等的记录 9、inner join(等值连接): 只返回两个表中联结字段相等的行 select * from MyTable1 aleft join MyTable2 bon a.ID=b.ID select * from MyTable1 a right join MyTable2 bon a.ID=b.ID select * from MyTable1 a inner join MyTable2 bon a.ID=b.ID