数据库笔记

筛选匹配字符串:

select * from direction_en where “from” like ‘% S8 %’

统计某一列数据的频率:

select author_id,count(*) cnt from
(select * from direction_en where “from” like ‘% S8 %’) as newtable
group by author_id

数据操作

更新(字段名词要引用):

update
direction_en
set “Building” =’S8’
where “from” like ‘% S8 %’

group by 关键字

select “Building”,count (“Building”)
from direction_en
group by “Building”
order by count

group by 和distinct 同时使用

select “Building”,count(distinct “author_id”)
from direction_en
group by “Building”
order by “count”

清空数据表

delect from table name

插入数据:

insert tablename (field1, field2,field3, field4) values(value1, value2,value3, value4)