mysql 问题汇总

来源:互联网 发布:pdf文字编辑器for mac 编辑:程序博客网 时间:2024/05/16 06:51
1、oracle 中的 查询语句自动产生顺序的排序,而mysql不行
mysql> select * from tags;+-------+-------+| docid | tagid |+-------+-------+|     1 |     1 ||     1 |     3 ||     1 |     5 ||     1 |     7 ||     2 |     2 ||     2 |     4 ||     2 |     6 ||     3 |    15 ||     4 |     7 ||     4 |    40 |+-------+-------+10 rows in set (0.07 sec) mysql> set @num=0;Query OK, 0 rows affected (0.00 sec) mysql> select @num:=@num+1,docid,tagid from tags;+--------------+-------+-------+| @num:=@num+1 | docid | tagid |+--------------+-------+-------+|            1 |     1 |     1 ||            2 |     1 |     3 ||            3 |     1 |     5 ||            4 |     1 |     7 ||            5 |     2 |     2 ||            6 |     2 |     4 ||            7 |     2 |     6 ||            8 |     3 |    15 ||            9 |     4 |     7 ||           10 |     4 |    40 |+--------------+-------+-------+10 rows in set (0.01 sec) mysql>

2、查询包含汉字、查询前十个、查询表中字段类型


查看表中各个字段类型和备注select column_name,column_comment,data_type from information_schema.columns where table_name='stockdates';Alter table stockdates modify pe integer default NULL;select chg from stockdates where chg like '%[吖-座]%'  limit 10;


3、Python连接mysql中文输出乱码,在连接数据的连接参数里加上字符集说明查询出的结果的编码,这个不加的后果可能是查询出的汉字字符都是问号

conn=pymssql.connect(server='.',user='', password='',database='MyTest',charset='utf8')







原创粉丝点击