Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Is there a DB that will allow a user to create a table with two fields, one calls MYFIELD, the other called myfield?

share|improve this question
14  
I think the larger question is "Why would you do that?" You will quickly have confusion about which field means what and how you're managing your data. Maybe if you provide some context, we can offer you a better solution? –  Mike Fal Jul 24 '13 at 17:47
8  
Is there a brand of bleach that doesn't have all these silly poison warnings all over the label? –  db2 Jul 24 '13 at 18:52
5  
Yes. Every ANSI compatible DBMS, because "FOO", "Foo" and "foo" are different names (because they are quoted identifiers) –  a_horse_with_no_name Jul 24 '13 at 20:34
9  
In short: You can do it almost everywhere, you shouldn't do it anywhere. –  Erwin Brandstetter Jul 25 '13 at 2:56
3  
Is this the kind of criteria you're going to use to choose your database platform? This is like choosing a house based on the color of the nearest fire hydrant and whether it matches the tie you're wearing today. –  Aaron Bertrand Jul 25 '13 at 3:56

4 Answers 4

Yes, there is. You have to change the database collation from CI (case insensitive) to CS (case sensitive). You can do that by using T-SQL, such as:

ALTER DATABASE TEST
COLLATE Latin1_General_CS_AS

Or in SQL Server Management Studio:

  1. Right-click the database in Object Explorer
  2. Select Properties
  3. Select the Options tab
  4. Change a new collation in the drop-down menu enter image description here
share|improve this answer

In Oracle, object names default to UPPERCASE. But object names can be overridden to be exact case.

CREATE TABLE MYTABLE 
(
  MYFIELD VARCHAR2(20) 
, "myfield" VARCHAR2(20) 
);
table MYTABLE created.
share|improve this answer

For what it's worth, DB2 also allows it:

$ db2

db2 => CREATE TABLE "do not do this"("Horrible_Idea" INTEGER, HORRIBLE_IDEA INTEGER)
DB20000I  The SQL command completed successfully.
share|improve this answer
1  
+1 for horrible_idea :) –  Jack Douglas Jul 25 '13 at 13:04

Also PostgreSQL, when using quoted identifiers. With your example it would look like

CREATE TABLE strange (
    "myfield" text,
    "MYFIELD" text,
    "MyField" text
);

Have a look at the documentation, too.

share|improve this answer
2  
A short code example would be nice. Maybe even a reference to the manual? Hint. –  Erwin Brandstetter Jul 25 '13 at 2:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.