MySQL queries tables with matching letters

Source: Internet
Author: User
Tags mysql query optimization

MySQL query is the core function of MySQL. Sometimes we need to find tables with matching letters. The following describes the MySQL query method for your reference.

In MySQL, we can use the LIKE or not like operator for comparison. In MySQL, the mode is case-insensitive by default.

Query example: student table
+ -------- + --------- + ------- + --------------- + --------- +
| Studid | name | marks | address | phone |
+ -------- + --------- + ------- + --------------- + --------- +

Mysql> select * from student where name like'm % ';
Lists the names of all students whose names start with M in the student table.

Mysql> select * from student where name like '% E ';
Lists All student names ending with the letter e.

Mysql> select * from student where name like '% a % ';
Lists student names that contain any specific letter anywhere. The following query example lists the student names that contain the letter ".

Mysql> select * from student where name like '_____';
If the name we are looking for contains five letters, we can use the special letter "_" underline ). The student table contains the names of five students.

MySQL query cache Variables

How to optimize MySQL Query

Five useful methods for MySQL Query Optimization

Design efficient and reasonable MySQL query statements

MySQL Query Optimizer

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.