An explanation of the problem of adding double-quotes to the table name and field names when querying Oracle SQL statements

Source: Internet
Author: User

As Oracle's just starting to learn, I'm sure you'll meet this problem.

Obviously is the Navicat visualization created the table, but just can't find! Why is this?

select * from user;

However, we assume that the user is not the same as the double-cited!

SELECT * from "user";

But can wait for the following results.



Here I think you will certainly say: "Oracle and MySQL, and so different, the query must be added to the double-cited?" That's not very troublesome! So after finding the data to draw for example the following conclusions:

1. Oracle tables and fields have uppercase and lowercase differences. Oracle is capitalized by default. Suppose we use a double-quoted number to differentiate between uppercase and lowercase, assuming no, the system will take its own initiative to capitalize.

2, when we use Navicat to create a database using visual,Navicat to give us the initiative to add "". This is what the actual code is when we create the database: (through the files of the SQL statements everywhere, it's not hard to understand why we can't find the table.) )

DROP TABLE "ROOT". User "; CREATE TABLE "ROOT". User "(" userid "number (2) not NULL)-------here. I think those who always use visualizations to create tables and fields are navicat.
3. Do I create tables and fields with SQL statements?
① do not add two-pin to create the change:

CREATE TABLE "ROOT". Personal_user_table (personal_id number () not NULL, login_name VARCHAR2 (in bytes) NOT NULL, Login_pas Sword VARCHAR2 (1 bytes) is not NULL, register_time DATE is not null, fullname VARCHAR2 (in bytes) is not null, and sex CHAR (BYTE) null , Id_card char (byte) null, email VARCHAR2 (byte) NULL, Tel CHAR (one-byte) null, address VARCHAR2 (in bytes) NULL, Work_un  Its VARCHAR2 null, monthly_income number (8,2) NULL, Bank_account CHAR (in bytes) NULL, credit_rating number (1) NULL )

As a result we express this:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvd2fuz2hhaxbpbmcxotkz/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/center ">

The ② and double-quotes are the same as we do with the Navicat visualization:

CREATE TABLE "ROOT". Personal_user_table "(" personal_id "number () not NULL," Login_name "VARCHAR2 (BYTE) is not null," Login_password "Varcha R2 (byte) is not NULL, "Register_time" DATE is not NULL, "FullName" VARCHAR2 (byte) is not null, "Sex" CHAR (1 BYTE) null, "Id_c ard "char" null, "email" VARCHAR2 ($) NULL, "Tel" char (one-byte) null, "Address" VARCHAR2 (+ byte) null, "work _units "VARCHAR2" null, "Monthly_income" number (8,2) null, "Bank_account" CHAR (BYTE) null, "Credit_rating" NUMB ER (1) NULL)


The results are as follows:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvd2fuz2hhaxbpbmcxotkz/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/center ">


It is therefore recommended that:

1. It is recommended that our visual operators also develop the habit of writing handwritten SQL statements, and we do not use double-quotes when creating them!

So we can get to like MySQL and so on without distinguishing between uppercase and lowercase.

2. We recommend that we try to capitalize on the habit of manipulating databases.





An explanation of the problem of adding double-quotes to the table name and field names when querying Oracle SQL statements

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.