简体   繁体   English

表中存储的数据是否区分大小写?

[英]Is data stored in tables case sensitive?

I have three table samples. 我有三个表样本。 I have used mysql to store data in database 我用mysql在数据库中存储数据

+--------------------------+
| Table-1                  |
+--------------------------+
| Sl.No | Name | City      |
+-------+------+-----------+
|  1    | Carl | Australia |
+-------+------+-----------+

+--------------------------+
| Table-1                  |
+--------------------------+
| Sl.No | Name | City      |
+-------+------+-----------+
|  1    | carl | australia |
+-------+------+-----------+

+--------------------------+
| Table-1                  |
+--------------------------+
| Sl.No | Name | City      |
+-------+------+-----------+
|  1    | CARL | AUSTRALIA |
+-------+------+-----------+
  • clearly we can see one row of data in each table 很明显,我们可以在每个表中看到一行数据
  • nature of data is same 数据的性质是一样的

what I have done is I have used different case letters some are uppercase letters and some are lowercase letters. 我所做的是我使用了不同的大小写字母,有些是大写字母,有些是小写字母。

Are data stored in database case sensitive? 数据存储在数据库区分大小写吗?

Data is just stored as raw data. 数据仅存储为原始数据。 However if you want to get the data in any particular format you can format it. 但是,如果要以任何特定格式获取数据,可以对其进行格式化。 You may insert the data as per your convinience however internally they are interpreted the same ie, ABC is same as abc and aBc 您可以根据自己的方便插入数据,但内部解释相同,即ABC is same as abc and aBc

By default MySQL queries are not case-sensitive. 默认情况下,MySQL查询不区分大小写。

From the MySQL site 来自MySQL网站

the case sensitivity of the underlying operating system plays a part in the case sensitivity of database and table names. 底层操作系统的区分大小写在数据库和表名称的区分大小写中起作用。 This means database and table names are not case sensitive in Windows, and case sensitive in most varieties of Unix. 这意味着数据库和表名在Windows中不区分大小写,并且在大多数Unix中区分大小写。 One notable exception is Mac OS X, which is Unix-based but uses a default file system type (HFS+) that is not case sensitive. 一个值得注意的例外是Mac OS X,它基于Unix,但使用不区分大小写的默认文件系统类型(HFS +)。 However, Mac OS X also supports UFS volumes, which are case sensitive just as on any Unix. 但是,Mac OS X还支持UFS卷,它们在任何Unix上都是区分大小写的。

On a side note:- 在旁注: -

Inside the database, all data is stored in binary format. 在数据库内部,所有数据都以二进制格式存储。 You can have different data types which is used by the computer to interpret how to show the data to the user, but that is just a mask. 您可以使用不同的数据类型,计算机使用这些数据类型来解释如何向用户显示数据,但这只是一个掩码。

yes, the database stores the data how you submit it. 是的,数据库存储数据提交方式。

if you say: 如果你说:

INSERT INTO MyTable (LowerCase, UpperCase) VALUES ("abcd", "ABCD");

it will insert: 它会插入:

LowerCase | UpperCase
abcd      | ABCD

if you do 如果你这样做

INSERT INTO MyTable (LowerCase, UpperCase) VALUES ("AbCd", "aBcD");

it will insert: 它会插入:

LowerCase | UpperCase
AbCd      | aBcD

it's up to you to sanitize the inputs to the case you want, or just let it go as entered. 由你来清理你想要的案件的输入,或者只是按照输入的方式让它去。

however, when I do a 但是,当我做一个

SELECT * FROM MyTable WHERE LowerCase="abcd";

it will return both entries. 它将返回两个条目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MySQL区分大小写表转换 - MySQL Case Sensitive Tables Conversion MySql-不同服务器中表的区分大小写问题 - MySql - Case Sensitive issue of tables in different server MySQL存储过程查询区分大小写,但简单查询返回的结果不区分大小写 - MySQL stored procedure query become case sensitive but simple query returns results without case sensitive 用于文本数据的MySQL区分大小写的外键 - MySQL case sensitive foreign key for textual data 在特定数据中获取字母位置区分大小写 - get letter location case sensitive in a specific data 如何使 MySql 表数据区分大小写? - How to make MySql table data Case Sensitive? 不区分大小写的查询,使用 Hibernate 和 mysql 返回区分大小写的数据 - Case insensitive query that returns case sensitive data with Hibernate and mysql 如何使用Rails查询获取区分大小写的数据 - How to get case-sensitive data with rails query 如何仅对 MySQL 中的数据子集强制执行区分大小写的唯一索引? - How to enforce case sensitive unique index only on subset of data in MySQL? 我可以使用IN运算符在MySQL中以区分大小写的方式查询数据吗? - Can I use IN operator to query data in case sensitive manner in MySQL?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM