1、了解数据库和表
show databases;
use testdb;
show tables;
show columns from stock;
describe stock;
show status;
show grants;
show errors;
select code from stock;
select code, close from stock;
select * from stock;
select distinct code from stock;
select distinct code from stock limit 10;
select distinct code from stock limit 2, 5;
select stock.code from stock;
select stock.code from testdb.stock;
select code from stock order by code;
select code, time, close, volume from stock order by code, close;
select code, time, close, volume from stock order by code, close DESC;
select code, time, close, volume from stock order by code DESC, close;
select code, time, close, volume from stock order by code DESC, close DESC;
select code, time, close, volume from stock order by code DESC, close DESC limit 1;
select code, time, close, volume from stock order by close DESC limit 1;
select * from stock where time='2021-01-13';
select * from stock where code='600009.XSHG';
select * from stock where close>500;
select * from stock where close between 300 and 400;
select * from stock where close is NULL;
select * from stock where close>500 and time='2021-01-13';
select * from stock where close>500 or close<1.5;
select * from stock where ( close>500 or close<1 ) and time='2021-01-13' order by close DESC;
select * from stock where code in ('600009.XSHG', '600519.XSHG');
select * from stock where code in ('600009.XSHG', '600519.XSHG') and time='2021-01-13' order by close;
select * from stock where code in ('600009.XSHG', '600519.XSHG') and not time='2021-01-13';
select * from stock where code like '688%' and time='2021-01-13';
select * from stock where code like '%221%' and time='2021-01-13';
select * from stock where code like '6%G' and time='2021-01-13';
select * from stock where code like '603___.XSHG' and time='2021-01-13';