标签:ext sele http chm sub set value where soc
1,查看数据库: show databases;
2,使用数据库: use 数据库名;
3,查询表格: show tables;
4,查看表结构:desc 表格;
4,创建表格,删除表格,修改等设置,Navicat可以很容易完成的,不记录了
5,增、删、改、查,以下表为例
注意符号要切换到英文呀!
增加:insert into student value (10,"张三","男");
删除:delete from student where id=3;
修改:update student set name="李四" where id=9;
查询:select * from score order by socre desc ;
1,select * from message ORDER BY r_send_time desc limit 10
2,update message set r_phone="17300060001" where id = 4
3,select student.name,score.socre from score LEFT JOIN student on score.s_id=student.id where sex="男" group by subject order by score.socre desc;
或者
select a.name,b.socre from score b LEFT JOIN student a on b.s_id=a.id where sex="男" group by subject order by b.socre desc;
JOIN 按照功能大致分为如下三类:
INNER JOIN(内连接,或等值连接):获取两个表中字段匹配关系的记录。
LEFT JOIN(左连接):获取左表所有记录,即使右表没有对应匹配的记录。
RIGHT JOIN(右连接): 与 LEFT JOIN 相反,用于获取右表所有记录,即使左表没有对应匹配的记录。
6,字符集编码:
SHOW VARIABLES LIKE ‘character_set_%‘ -- 查看所有字符集编码项
设置编码格式
set character_set_client = gbk;
set character_set_results = gbk;
set character_set_connection = gbk;
标签:ext sele http chm sub set value where soc
原文地址:http://www.cnblogs.com/hanyu258/p/7737494.html