SQL string connection Function

Source: Internet
Author: User
The SQL String concatenation function uses CONCAT () in the SQL String concatenation function. The CONCAT () syntax is as follows: CONCAT (string 1, string 2, string 3 ,...): concatenates string 1, string 2, string 3, and other words

The SQL String concatenation function uses CONCAT () in the SQL String concatenation function. The CONCAT () syntax is as follows: CONCAT (string 1, string 2, string 3 ,...): concatenates string 1, string 2, string 3, and other words

The SQL String concatenation function uses concat () in the SQL String concatenation function. The concat () syntax is as follows: concat (string 1, string 2, string 3 ,...): concatenates string 1, string 2, string 3, and other words. Note that oracle concat () only allows two parameters. In other words, only two strings can be connected at a time. However, in oracle, we can use '|' to concatenate multiple strings at a time.

Select region_name + ''+ store_name from geography
Where store_name = 'boston ';

Instance method

A:

Id value

1 111111111

2 222222222

3 333333333


Table B:

Id data

11-11111-11

10 22-22222-22

11 33-33333-33

Select * from a where substring (value, 1, 2) + '-' + substring (value, 3, 5) + '-' + substring (value, 8, 2)

Not in (select B from data );


Method 2

Select *
From
Where (substr (value, 0, 2) | '-' | substr (value, 2, 5) | '-' |
Substr (value, 8, 9) not in (select B from data );
Or directly update the value.

Update a set value = (substr (value, 0, 2) | '-' | substr (value, 2, 5) | '-' |
Substr (value, 8, 9 ));


If it is not oracle, replace substr with substring, | Replace with +

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.