SQL Like

SQL Like

The SQL “LIKE” operator is used in a query to search for a specific pattern in a column’s data. It is often used with the “WHERE” clause in a SELECT statement.

The “LIKE” operator allows you to perform pattern matching using wildcard characters. The two commonly used wildcard characters are:

  1. “%” (percent sign): Represents any sequence of characters.
  2. “_” (underscore): Represents any single character.

Here’s an example to illustrate the usage of the “LIKE” operator:

sql
SELECT * FROM employees WHERE last_name LIKE 'Sm%';

In this example, the query selects all rows from the “employees” table where the “last_name” column starts with ‘Sm’. The ‘%’ wildcard represents any sequence of characters that can follow ‘Sm’.

You can also use the ‘%’ wildcard at the beginning or end of the pattern or even both. Here are a few more examples:

sql
SELECT * FROM employees WHERE first_name LIKE '%an%';

This query retrieves all rows from the “employees” table where the “first_name” column contains the substring ‘an’ anywhere in the name.

sql
SELECT * FROM employees WHERE email LIKE '[email protected]';

This query selects all rows from the “employees” table where the “email” column has a single character followed by ‘@gmail.com’. The ‘_’ wildcard represents any single character.

It’s important to note that the “LIKE” operator is case-insensitive by default in most database systems. However, this behavior can vary depending on the database engine or the collation settings.

Additionally, some database systems provide additional wildcard characters and functionality beyond the basic ‘%’ and ‘_’ wildcards.

Leave a Reply

Your email address will not be published. Required fields are marked *

GLOTRU Footer
Popular Features
Popular Services/

Website Development & Design

App Development & Design

Graphic Design

Digital Marketing

SEO (Search Engine Optimization)

SMM (Social Media Marketing)

Cyber Security

Company

GLOTRU Founder & CEO : __Azam

Registared : Trade,MSME,etc

Board of Director

Team

About Us

Contact Us

Privacy Policy

Return & Refund Policy

Abuse Policy

Copyright Policy

Cookie Policy

Terms & Conditions

Universal Terms of Service

Disclaimer

Legal

Sponsorships

Investor

Press Releases

Our Investments

Brands

Newsroom

Business

...

_

Digital Millennium Copyright Act
DMCA.com Protection Status

_

Content similarity detection
Protected by Copyscape

_

***ANTI-PIRACY WARNING***

...................................................................................

Follow Us :

...................................................................................

SECURE SERVER : [Legal] [Privacy Policy] [Universal Terms of Service] [Do not sell my personal information]

SITE HOSTED : GLOTRU SECURE SERVER Asian Data Centre [You can host your site][Click Here]

SSL : Server Type : [Cloudflare] Certificate Issued By : [Let's Encrypt] Signature Algorithm : [ECDSA with SHA-384]

SITE BUILD SOFTWARE : Content Management System (CMS) Softwere

_

_

_