Are MySQL primary key values case sensitive? If it's an option how do I set it? I want the table to be able to store "www.Example.com" and "www.example.com" as different values.
yes. ci is case insensitive.
In SQL Server, by default, primary keys are case-insensitive and when you transfer data from Oracle to SQL Server and then try to create the primary key constraints, you may have duplicate key errors.
You can do this in SQL Server Management Studio via the Object Explorer by right-clicking on the database and going to "Properties > Options" then the "Collation" drop-down. Any one that has "CS" in the name is case-sensitive.
Table names are stored in lowercase on disk and name comparisons are not case-sensitive. MySQL converts all table names to lowercase on storage and lookup. This behavior also applies to database names and table aliases.
You can set per-column collations in MySQL: https://dev.mysql.com/doc/refman/5.5/en/charset-column.html
e.g. if your table is generally (say) case insensitive, you can override it per-field to be case-sensitive.
The BINARY
keyword will do the trick, though I'm not sure if it's the recommended way to do this:
CREATE TABLE testpk (MyPK VARCHAR(20) BINARY PRIMARY KEY NOT NULL)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With