当前位置: 首页 > news >正文

销售公司怎么做网站营销平台建设

销售公司怎么做网站,营销平台建设,如何去掉wordpress,杭州网站制作单表查询 所有的查找都会得到一张虚拟表 一、 最简单的查询 SELECT 123; SELECT asd; SELECT 11;二、 从表中获取数据 select 字段名,字段名 from 表名 2.1 全字段查询 SELECT sid,sname,birthday,ssex,classid FROM student; SELECT * FROM student; -- 使用*不利于s…

单表查询

所有的查找都会得到一张虚拟表

一、 最简单的查询
SELECT 123;
SELECT 'asd';
SELECT 1+1;
二、 从表中获取数据
select 字段名,字段名 from 表名 
2.1 全字段查询
SELECT sid,sname,birthday,ssex,classid FROM student;
SELECT * FROM student;     -- 使用*不利于sql优化,不推荐
2.2 部分字段查询
SELECT sname,ssex FROM student;
2.3 字段名起别名
select sname as '姓名',birthday '生日', ssex 性别 from student;
2.4 添加字段
select sname,'yjy' 学校 from student
2.5 distinct
-- 所有的字段的数据要一致才会去重select distinct sid,sname,ssex from student
2.6 带条件的查询
(1)where 子句过滤查询结果,以仅返回满足特定条件的记录
select * from student where sid=5;
select * from student where sid<>5;
select * from student where sid>5;
select * from student where sid between 3 and 6;
示例:
-- 查找1班的女同学select * from student where classid=1 and ssex='女';-- 查询 年龄 大于1990-1-1 的学生select * from student where birthday < '1990-1-1';
(2)in 在某个特定的范围
-- 3  5  7  9
-- or 会让索引失效select * from student where sid = 3 or sid = 5 or sid = 7 or sid = 9;
-- 推荐 
-- in 可以用到索引select * from student where sid in(3,5,7,9)
(3)like 模糊查询模糊符号:a. % 任意多的任意字符b. _ 一个任意字符
insert into student(sname) values('杨佳佳'),('小杨'),('杨同学');insert into student(sname) values('帅气的杨同学');select * from student where sname like '%杨%'select * from student where sname like '杨%'select * from student where sname like '%杨'select * from student where sname like '杨_'select * from student where sname like '杨__'   -- 两个下划线
(4)null
select * from student where birthday is nullselect * from student where birthday is not null
2.7 聚合函数
把多个值变为一个值a.count() 统计个数b.max() 求最大值c.min() 求最小值d.sum() 求总和e.avg() 求平均数
-- count 不统计null
-- select count(字段\常量\*) from 表名select count(sid) from student;	-- 主键select count(classid) from student;	-- 不统计nullselect count('a') from student;		-- 不推荐select count(1) from student;	-- 推荐select count(*) from student;	-- 推荐
-- sum avg min max  数值类型select sum(score) from sc;select avg(score) from sc;select max(score) from sc;select min(score) from sc;
示例:
-- 统计出成绩表中一共有多少次考试,总成绩,平均分,最高分,最低分select count(*),sum(score),avg(score),max(score),min(score) from sc;
2.8 分组 group by
对所有的数据进行分组统计,分组的依据字段可以有多个,并依次分组
-- 统计各班有多少人select classid,count(1) from student group by classid -- 成绩表 统计每个同学的 总分和平均分select sid,sum(score),avg(score) from sc group by sid
2.9 having
与group by结合使用,进行分组后的数据筛选
-- 查询平均分不及格的sidselect sid ,sum(score),avg(score) from sc group by sid having avg(score) < 60
2.10 order by 排序
(1)按照先写的字段排序,如果有相同的按照下一个字段排序
(2)升序 asc(默认)
(3)降序 desc 必须声明
示例:
select * from student order by classid desc;	-- desc:降序
select * from student order by classid asc; -- asc:升序
select * from sc order by score desc,cid desc;
2.11 limit 分页

0 开始 (页码-1)*步长,步长

-- select * from student limit 位置,步长select * from student limit  6,3-- 应用层解决
-- select * from student limit (3-1)*3,3  错误的-- 找到成绩及格的总分数排名第二的  select sid,sum(score) from sc where score>=60 group by sid  order by sum(score) desc limit 1,1
http://www.dinnco.com/news/69093.html

相关文章:

  • 视频网站用户增长怎么做如何建立网站平台
  • 可以做外链的图片网站肇庆网站建设制作
  • 个人视频网站制作怎么推广网站
  • 政府网站集约化建设作用百度搜索什么关键词排名
  • 网站建设方案书制作流程原创文章代写
  • 如何设计网站logo0元做游戏代理
  • 网站续费多少钱seo外链平台热狗
  • js素材网站网游百度搜索风云榜
  • 无锡做企业网站的公司bt种子搜索
  • 做网站最基本互联网营销专业
  • 重庆做营销网站建设爱站网关键词挖掘工具站长工具
  • 建设银行网站的机构广州各区风险区域最新动态
  • 正规免费发布信息网站商旅平台app下载
  • 网站的橱窗怎么做湖南seo推广系统
  • 网站免费正能量直接进入小说近期时事新闻
  • 天猫网站左侧导航是怎么做的青岛网站权重提升
  • 做旅游网站公司win10必做的优化
  • 多少钱算受贿百度seo关键词排名技术
  • 青岛手机网站建设报价滕州百度推广
  • 网页设计与制作前景如何优化方案丛书官网
  • 网站这么设置微信支付网店代运营合同
  • 做云词图的网站seo发外链的网站
  • wordpress的robots.txt网站优化关键词
  • 丑女毒妃战神王爷赖上身seo流量增加软件
  • 江门seo哪家专业做网站怎么优化
  • 收企业做网站备案seo服务外包
  • 独立b2c网站有哪些手机怎么做网站免费的
  • 石景山网站制作案例网络推广的网站有哪些
  • 上海哪些做网站google推广服务商
  • 网站首页布局设计草图网页制作代码html制作一个网页