MYSQL: LIKE with Except Condition

xXxrk04

I need some help. I want to show database that has name "sample" but except "sample" with "fallback" word.

Database Name
  sample_1
  2_sample
  sample_fallback
  samsple_2
  s_sample
  fallback_sample

I just want to get:

sample_1
2_sample
samsple_2
s_sample

What should I add from this query?

  "SHOW DATABASES LIKE '%sample%';"
O. Jones

You're going to need to query the information_schema directly to get this list.

select schema_name 
  from information_schema.schemata
 where schema_name like '%sample%'
   and schema_name not like '%fallback%'

SHOW DATABASES isn't flexible enough.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Multiple like condition in mysql

分類Dev

MySQL LIKE IN()?

分類Dev

SQL like '%term%' except without letters

分類Dev

mysql SELECT where like and like

分類Dev

Mysql custom where condition

分類Dev

mySQL select with condition replyTo

分類Dev

MySQL query WHERE condition

分類Dev

A layout like the tall layout, except that master area windows are in columns

分類Dev

Mysql select by condition unless another condition is met

分類Dev

mysql like query to get max like

分類Dev

If condition with group_concat in mysql

分類Dev

how to using group by with condition in mysql

分類Dev

MySQL max value for each condition

分類Dev

How to combine "LIKE" with "IN" in a MYSQL query?

分類Dev

MySQL:LIKEのssとß

分類Dev

MySQL Match Against&Like

分類Dev

Mysql - Add if condition in the Mysql Query or a where clause

分類Dev

How to use like in where condition in sequelize, node js

分類Dev

How to ADD all files/directories except a hidden directory like .git in Dockerfile

分類Dev

How to use if condition with left join in mysql

分類Dev

Where condition not working on MySQL union 2 tables

分類Dev

Mysql: How to query with if else condition inside if

分類Dev

MySQL how to populate query columns based on a condition?

分類Dev

How to add composed column into the WHERE condition of MySQL

分類Dev

Using an array to put into where condition MySQL query

分類Dev

Is it possible to give condition in MYSQL database column?

分類Dev

Null or Not Null value in mysql where condition

分類Dev

Add Exception or condition for logged in user PHP MYSQL

分類Dev

mysql additional condition after INNER JOIN, ON

Related 関連記事

ホットタグ

アーカイブ