কম্পিউটার

ডাইনামিক অ্যারে সহ MySQL লাইক কোয়েরি?


ডায়নামিক অ্যারের সাথে LIKE ক্যোয়ারী বাস্তবায়ন করতে, সিনট্যাক্সটি নিম্নরূপ -

উদাহরণ

select *from yourTableName
   where yourColumnName2 like "%yourValue%"
   order by yourColumnName1 asc
   limit yourLimitValue;

আসুন একটি টেবিল তৈরি করি -

উদাহরণ

mysql> create table demo74
   -> (
   -> user_id int not null auto_increment primary key,
   -> user_names varchar(250)
   -> )
   -> ;
Query OK, 0 rows affected (0.67

সন্নিবেশ কমান্ড -

এর সাহায্যে টেবিলে কিছু রেকর্ড সন্নিবেশ করুন

উদাহরণ

mysql> insert into demo74(user_names) values("John Smith1,John Smith2,John Smith3");
Query OK, 1 row affected (0.18

mysql> insert into demo74(user_names) values("John Smith1");
Query OK, 1 row affected (0.15

mysql> insert into demo74(user_names) values("David Smith1");
Query OK, 1 row affected (0.12

mysql> insert into demo74(user_names) values("John Smith1,John Smith2,John Smith3,John Smith4");
Query OK, 1 row affected (0.10

সিলেক্ট স্টেটমেন্ট -

ব্যবহার করে টেবিল থেকে রেকর্ড প্রদর্শন করুন

উদাহরণ

mysql> select *from demo74;

এটি নিম্নলিখিত আউটপুট −

তৈরি করবে

আউটপুট

+---------+-------------------------------------------------+

| user_id | user_names                                      |

+---------+-------------------------------------------------+

|       1 | John Smith1,John Smith2,John Smith3             |

|       2 | John Smith1                                     |

|       3 | David Smith1                                    |

|       4 | John Smith1,John Smith2,John Smith3,John Smith4 |

+---------+-------------------------------------------------+

ডায়নামিক অ্যারে -

সহ MySQL LIKE ক্যোয়ারী নিচে দেওয়া হল

উদাহরণ

mysql> select *from demo74
-> where user_names like "%John Smith1%"
-> order by user_id asc
-> limit 100;

এটি নিম্নলিখিত আউটপুট −

তৈরি করবে

আউটপুট

+---------+-------------------------------------------------+

| user_id | user_names                                      |

+---------+-------------------------------------------------+

|       1 | John Smith1,John Smith2,John Smith3             |

|       2 | John Smith1                                     |

|       4 | John Smith1,John Smith2,John Smith3,John Smith4 |

+---------+-------------------------------------------------+

3 rows in set (0.00 sec)


  1. % সহ একটি কলামের মান অনুসন্ধান করতে MySQL LIKE ক্যোয়ারী কীভাবে ব্যবহার করবেন?

  2. LIKE অপারেটরের সাথে একাধিক ক্ষেত্রে একই মান খুঁজে পেতে MySQL ক্যোয়ারী?

  3. MySQL-এ একটি সিলেক্ট ক্যোয়ারী দিয়ে সন্নিবেশ করুন

  4. MySQL লাইককে MySQL IN হিসাবে প্রয়োগ করার জন্য প্রশ্ন?