Single quotation marks and double quotation marks in SQL statements

Source: Internet
Author: User

In SQL databases, it is often difficult to figure out whether to write single quotes or double quotes when writing some statements. After some queries, I agree with the following. Here, the string type is used as an example:

When I have a table named studentname, there is a field named

I want to insert a name named "Zhang San" into it, so

Strtxtsql = "insert into studentname (name) value ('zhang san ')"

Because it is a string, single quotation marks must be placed on both sides of the insert statement. If "Michael" is replaced with a variable A, the statement is:

Strtxtsql = "insert into studentname (name) value ('" & &"')"

Here, if variable A is to replace Michael, it needs to be "& A &", which requires a connector and double quotation marks. In comparison with the above sentence, double quotation marks are used to include variables, A single quotation mark is a value that contains a field.

Here is just a comment on the string quotation marks. Of course, different types are also different, so you must note when writing.

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.