Search(Select)

Search (Select)

To get all columns

Specify * after select.
Example) Get all columns for the record with id 10.

select * from Customer where id = 10;
idnamekana
10Ichiro SuzukiIchiro Suzuki

Example) Get all columns of records with IDs between 2 and 5.

select * from Customer where  2 >= id and id <= 5;
select * from Customer where id between 2 and 5;
idnamekana
2Jiro SuzukiJiro Suzuki
3Suzuki SaburoSuzuki Saburo
4Suzuki ShiroSuzuki Shirou
5Goro SuzukiGoro Suzuki

To get some columns

Specify the column name you want to retrieve after select.
Example) Get the name column for the record with id 10.

select `name` from Customer where id = 10;
name
Ichiro Suzuki

Example) Get only the name column of records whose ID is between 2 and 5.

select `name` from Customer where  2 >= id and id <= 5;
select `name` from Customer where id between 2 and 5;
< td>Saburo Suzuki
name
Jiro Suzuki
Shiro Suzuki
Goro Suzuki