Note that there are some explanatory texts on larger screens.

plurals
  1. POJava DB / Derby - white space in table name - how to escape?
    primarykey
    data
    text
    <p>Java DB / Derby - white space in table (column) name - how to escape? In MySQL database it is escaped simply by &#96;&#96; (grave accent), but if I trying to execute query (Java DB) like: </p> <pre><code>CREATE TABLE `etc etc` (ID INT PRIMARY KEY, Title VARCHAR(12)) </code></pre> <p>I get the error: </p> <blockquote> <p>java.sql.SQLSyntaxErrorException: Lexical error at line 1, column 14. Encountered: "`" (96), after : "".</p> </blockquote> <p>Is there any solution?</p> <p><strong>EDITED:</strong></p> <p>Thanks for comprehensive answers indeed. I found interesting thing (Java DB):</p> <p>it was OK to create table like this:</p> <pre><code>CREATE TABLE "etc etc" (ID INT PRIMARY KEY, Title VARCHAR(12)) </code></pre> <p>and later to get the results:</p> <pre><code>SELECT * FROM "etc etc" </code></pre> <p>But if I create the table like this (without white space and quotes):</p> <pre><code>CREATE TABLE etc_etc (ID INT PRIMARY KEY, Title VARCHAR(12)) </code></pre> <p>and later get the results like this (with double quotes, just for example, they don't really needed):</p> <pre><code>SELECT * FROM "etc_etc" </code></pre> <p>I get the error: </p> <blockquote> <p>java.sql.SQLSyntaxErrorException: Table/View 'etc_etc' does not exist.</p> </blockquote> <p>So my conclusion is that if quotes were used while creating the table (it is not important if the name contains white space or not), later, while getting the results, quotes also should be used. And vice versa (int this case of course without white space).</p> <p>I agree it is better not to use white space, instead <code>_</code> character. But I liked on MySQL those &#96; grave accent characters...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload