먼저 테이블을 생성하겠습니다 -
mysql> create table DemoTable ( Subject text ); Query OK, 0 rows affected (0.86 sec)
삽입 명령을 사용하여 테이블에 일부 레코드 삽입 -
mysql> insert into DemoTable values('Introduction to MySQL');
Query OK, 1 row affected (0.31 sec)
mysql> insert into DemoTable values('Deep Dive using Java');
Query OK, 1 row affected (0.17 sec)
mysql> insert into DemoTable values('C in Depth');
Query OK, 1 row affected (0.17 sec)
mysql> insert into DemoTable values('Introduction to C++');
Query OK, 1 row affected (0.48 sec) select 문을 사용하여 테이블의 모든 레코드 표시 -
mysql> select *from DemoTable;
이것은 다음과 같은 출력을 생성합니다 -
+-----------------------+ | Subject | +-----------------------+ | Introduction to MySQL | | Deep Dive using Java | | C in Depth | | Introduction to C++ | +-----------------------+ 4 rows in set (0.00 sec)
다음은 LIKE 및 OR -
를 사용한 텍스트 검색 쿼리입니다.mysql> select *from DemoTable where Subject LIKE '%MySQL%' OR Subject LIKE '%using%';
이것은 다음과 같은 출력을 생성합니다 -
+-----------------------+ | Subject | +-----------------------+ | Introduction to MySQL | | Deep Dive using Java | +-----------------------+ 2 rows in set (0.00 sec)