[英]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 |
+-------+------+-----------+
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上都是区分大小写的。
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.