大橙子网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

mysql怎么看表大小写 mysql表大小查询

使MySQL查询区分大小写的实现方法

1、一种方法是可以设置表或行的collation,使其为binary或case

网站设计制作过程拒绝使用模板建站;使用PHP+MYSQL原生开发可交付网站源代码;符合网站优化排名的后台管理系统;成都网站设计、成都做网站收费合理;免费进行网站备案等企业网站建设一条龙服务.我们是一家持续稳定运营了十年的成都创新互联网站建设公司。

sensitive。在MySQL中,对于Column

Collate其约定的命名方法如下:

*_bin:

表示的是binary

case

sensitive

collation,也就是说是区分大小写的

*_cs:

case

sensitive

collation,区分大小写

*_ci:

case

insensitive

collation,不区分大小写

###########

#

Start

binary

collation

example

###########

mysql

create

table

case_bin_test

(word

VARCHAR(10))

CHARACTER

SET

latin1

COLLATE

latin1_bin;

Query

OK,

rows

affected

(0.02

sec)

mysql

INSERT

INTO

case_bin_test

VALUES

('Frank'),('Google'),('froogle'),('flickr'),('FlicKr');

Query

OK,

5

rows

affected

(0.00

sec)

Records:

5

Duplicates:

Warnings:

mysql

SELECT

*

FROM

case_bin_test

WHERE

word

LIKE

'f%';

+---------+

|

word

|

+---------+

|

froogle

|

|

flickr

|

+---------+

2

rows

in

set

(0.00

sec)

mysql

SELECT

*

FROM

case_bin_test

WHERE

word

LIKE

'F%';

+---------+

|

word

|

+---------+

|

Frank

|

|

FlicKr

|

+---------+

4

rows

in

set

(0.00

sec)

###########

#

End

###########

2、另外一种方法

###########

#

Start

case

sensitive

collation

example

###########

mysql

create

table

case_cs_test

(word

VARCHAR(10))

CHARACTER

SET

latin1

COLLATE

latin1_general_cs;

Query

OK,

rows

affected

(0.08

sec)

mysql

INSERT

INTO

case_cs_test

VALUES

('Frank'),('Google'),('froogle'),('flickr'),('FlicKr');

Query

OK,

5

rows

affected

(0.00

sec)

Records:

5

Duplicates:

Warnings:

mysql

SELECT

*

FROM

case_cs_test

WHERE

word

LIKE

'F%';

+---------+

|

word

|

+---------+

|

Frank

|

|

FlicKr

|

+---------+

4

rows

in

set

(0.00

sec)

mysql

SELECT

*

FROM

case_cs_test

WHERE

word

LIKE

'f%';

+---------+

|

word

|

+---------+

|

froogle

|

|

flickr

|

+---------+

2

rows

in

set

(0.00

sec)

###########

#

end

###########

3、还有一种方法就是在查询时指定collation

mysql

create

table

case_test

(word

VARCHAR(10))

CHARACTER

SET

latin1;

Query

OK,

rows

affected

(0.01

sec)

mysql

INSERT

INTO

case_test

VALUES

('Frank'),('Google'),('froogle'),('flickr'),('FlicKr');

Query

OK,

7

rows

affected

(0.01

sec)

Records:

7

Duplicates:

Warnings:

mysql

SELECT

*

FROM

case_test

WHERE

word

LIKE

'f%';

+---------+

|

word

|

+---------+

|

Frank

|

|

froogle

|

|

flickr

|

|

FlicKr

|

+---------+

6

rows

in

set

(0.01

sec)

mysql

SELECT

*

FROM

case_test

WHERE

word

LIKE

'F%';

+---------+

|

word

|

+---------+

|

Frank

|

|

froogle

|

|

flickr

|

|

FlicKr

|

+---------+

6

rows

in

set

(0.01

sec)

mysql

SELECT

*

FROM

case_test

WHERE

word

COLLATE

latin1_bin

LIKE

'F%';

+---------+

|

word

|

+---------+

|

Frank

|

|

FlicKr

|

+---------+

4

rows

in

set

(0.05

sec)

mysql

SELECT

*

FROM

case_test

WHERE

word

COLLATE

latin1_bin

LIKE

'f%';

+---------+

|

word

|

+---------+

|

froogle

|

|

flickr

|

+---------+

2

rows

in

set

(0.00

sec)

mysql

SELECT

*

FROM

case_test

WHERE

word

LIKE

'f%'

COLLATE

latin1_bin;

+---------+

|

word

|

+---------+

|

froogle

|

|

flickr

|

+---------+

2

rows

in

set

(0.00

sec)

mysql

SELECT

*

FROM

case_test

WHERE

word

LIKE

'F%'

COLLATE

latin1_bin;

+---------+

|

word

|

+---------+

|

Frank

|

|

FlicKr

|

+---------+

4

rows

in

set

(0.01

sec)

mysql

SELECT

*

FROM

case_test

WHERE

word

LIKE

'F%'

COLLATE

latin1_general_cs;

+---------+

|

word

|

+---------+

|

Frank

|

|

FlicKr

|

+---------+

4

rows

in

set

(0.04

sec)

mysql数据库表名区分大小写

使用mysql的时候,创建的表明都是大写的,但是查询语句中表明用消息就会报错,表不存在。

查询后发现mysql默认配置是表明区分大小写的,如果要修改成不区分大小写,需要修改一下配置。

mysql 怎么检查大小写敏感

1、linux下mysql安装完后是默认:区分表名的大小写,不区分列名的大小写;

2、用root帐号登录后,在/etc/my点吸烟 f 中的[mysqld]后添加添加lower_case_table_names=1,重启MYSQL服务,这时已设置成功:不区分表名的大小写;

lower_case_table_names参数详解:

lower_case_table_names = 0

其中 0:区分大小写,1:不区分大小写

MySQL在Linux下数据库名、表名、列名、别名大小写规则是这样的:

1、数据库名与表名是严格区分大小写的;

2、表的别名是严格区分大小写的;

3、列名与列的别名在所有的情况下均是忽略大小写的;

4、变量名也是严格区分大小写的;

MySQL在Windows下都不区分大小写。

3、如果想在查询时区分字段值的大小写,则:字段值需要设置BINARY属性,设置的方法有多种:

A、创建时设置:

CREATE TABLE T(

A VARCHAR(10) BINARY

);

B、使用alter修改:

ALTER TABLE `tablename` MODIFY COLUMN `cloname` VARCHAR(45) BINARY;

C、mysql table editor中直接勾选BINARY项。


网站标题:mysql怎么看表大小写 mysql表大小查询
URL地址:http://dzwzjz.com/article/ddshdsd.html
在线咨询
服务热线
服务热线:028-86922220
TOP