먼저 테이블을 생성하겠습니다 -
mysql> create table DemoTable ( Title text ); Query OK, 0 rows affected (0.86 sec)
삽입 명령을 사용하여 테이블에 일부 레코드 삽입 -
mysql> insert into DemoTable values('C is a good programming language to start'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('Java is good with data structure and algorithm'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values('Coding is very important'); Query OK, 1 row affected (0.20 sec)
select 문을 사용하여 테이블의 모든 레코드 표시 -
mysql> select *from DemoTable;
이것은 다음과 같은 출력을 생성합니다 -
+------------------------------------------------+ | Title | +------------------------------------------------+ | C is a good programming language to start | | Java is good with data structure and algorithm | | Coding is very important | +------------------------------------------------+ 3 rows in set (0.00 sec)
다음은 처음 20자 이후의 모든 문자를 선택하는 쿼리입니다 -
mysql> select substring(Title from 20) from DemoTable;
이것은 다음과 같은 출력을 생성합니다 -
+-----------------------------+ | substring(Title from 20) | +-----------------------------+ | ming language to start | | ata structure and algorithm | | rtant | +-----------------------------+ 3 rows in set (0.00 sec)