33 lines
912 B
SQL
33 lines
912 B
SQL
use test;
|
|
create table if not exists school (
|
|
school_code char(6) primary key,
|
|
school_name varchar(50),
|
|
province varchar(30),
|
|
is_985 varchar(10),
|
|
is_211 varchar(10),
|
|
is_self_marking varchar(10),
|
|
school_type varchar(10)
|
|
);
|
|
select * from school;
|
|
select count(*) from school;
|
|
select count(1) from school;
|
|
select count(school_code) from school;
|
|
select province, count(*) as c from school group by province order by c desc;
|
|
select * from school where province in ("江西省","湖南省");
|
|
select distinct province from school where province not in ("江西省");
|
|
select distinct province from school where province not like "%省";
|
|
select province, count(*) as c
|
|
from school
|
|
group by province
|
|
order by c desc;
|
|
drop table if exists school;
|
|
|
|
-- create table if not exists school(
|
|
-- school_code,
|
|
-- school_name,
|
|
-- province,
|
|
-- is_985,
|
|
-- is_211,
|
|
-- is_self_marking,
|
|
-- school_type
|
|
-- ) |