Query% percent and wildcard usage in SQL

Source: Internet
Author: User

First, PERCENT

New knowledge points are constantly being updated in the W3cschool. There are some feelings that do not have this concept, it should be almost useless at work for the sake of it, such as querying data in front of half:

SELECT TOP PERCENT * FROM table_name; Percentage (less) SELECT top * FROM table_name;//50 data in ascending order (common)

You can also filter the data by adding conditions such as where, in, specific fields, and so on.

Second, a wildcard character

SELECT * FROM table_name WHERE column_name like ' l_n_ ';//_ stands for any character

SELECT * FROM table_name WHERE column_name like ' [bsp]% ';//the character matching record starting with B or S is not [!bsp] or [^bsp]

SELECT * FROM table_name WHERE column_name like ' [a-c]% ';//the character matching record beginning with a,b,c

third, column_name not in is equivalent to not column_name in

SELECT * FROM table_name WHERE column_name is not in (a, b) is equivalent to

SELECT * FROM table_name WHERE not column_name in (A, B)

IV, between and and not between and which include 2 boundary values in SQL Server

V: If the column name contains spaces, double quotation marks or square brackets are required: field names are used in brackets with keywords [] to prevent collisions and misreading, full join (less)

Query% percent and wildcard usage in SQL

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.