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

谢岗镇网站仿做软文营销案例

谢岗镇网站仿做,软文营销案例,自动翻译wordpress中文标签别名为英文,做网站维护要什么专业【一】筛选过滤条件 【1】完整的查询语句 -- 查询当前表中的全部数据select * from 表名 where 筛选条件;​-- 查询当前表中的指定字段的数据select 字段名,字段名 from 表名 where 筛选条件;# 执行顺序from where select ​select 你选择的列1, 你选择的列2, ... from 查询的…

【一】筛选过滤条件

【1】完整的查询语句

-- 查询当前表中的全部数据select * from 表名 where 筛选条件;​-- 查询当前表中的指定字段的数据select 字段名,字段名 from 表名 where 筛选条件;# 执行顺序from
where
select
​select 你选择的列1, 你选择的列2, ...
from 查询的表名
where 筛选条件;

例如:

  • 等于:=(例如:age = 25

  • 不等于:<>!=(例如:age <> 25

  • 大于:>(例如:salary > 5000

  • 小于:<(例如:rating < 4.5

  • 大于等于:>=(例如:quantity >= 10

  • 小于等于:<=(例如:price <= 100

  • 模糊匹配:LIKE(例如:name LIKE 'J%'

  • 范围:BETWEEN(例如:age BETWEEN 18 AND 30

  • 列表:IN(例如:department IN ('IT', 'Finance')

具体示例:

select * from employeewhere employee_id = '2';

image-20240125193149346

【2】数据准备

( 1 )创建数据库

create database Student;

( 2 )切换到Student数据库

use Student;

image-20240125194108716

( 3 ) 创建school表

create table school (id int primary key auto_increment comment'id 信息',course varchar(255),lecturer varchar(255),address varchar(255)
);

( 4 )再插入我们需要的数据

insert into school (id, course, lecturer, address) values(1, 'go', 'xiao', '301'),(2, 'java', 'mao', '302'),(3, 'paython', 'jing', '303'),(4, 'seo', 'yi', '304'),(5, 'API接口', 'bao', '305'),(6, 'Vue', 'peng', '306'),(7, 'CSS', 'ban', '307'),(8, 'Web', 'tian', '308'),(9, 'MySQL', 'yun', '309');

( 5 ) 查询信息

select * from school;

image-20240125194836222

select * from school\G;# MySQL 将以垂直格式显示查询结果

image-20240125194948244

【3】查询联系

  • 查询 id 在 1 ~ 5 之间的数据

-- 原始模版select * from * where *;
​
-- 最麻烦的写法select * from school where id>=1 and id <=5;
​
-- 在SQL语句中没有 select * from school where 1<= id <=5;
​
-- 优化后的写法select * from school where id between 1 and 5;

image-20240125201114725

or

select * from * where *;
​
-- 最原始的写法 三个 orselect * from school where course='go' or course='java' or course='API接口';
​
-- 简单写法,成员运算select * from school where course in ('go','paython','seo');

image-20240125201441810

  • 查询 课程名称中包含字母a的课程

select * from * where *;
​# % 匹配多个字符
# _ 匹配一个字符select * from school where course like "%a%";select * from school where course like "_a%";

image-20240125201632215

image-20240125201712554

  • 查询课程,跟老师姓名是由六个字符组成

select lecturer,course from school where char_length(lecturer) = 4;

image-20240125201943539

【二】分组条件

【1】分组条件group by

  • 每个,平均、最高、最低

【2】语法

select * from 表名 group by 分组条件;select 列名1, count(*), sum(列名2), avg(列名3)from table_namegroup by 列名1;# 查询所有列select group_concat(course) from 表名 group by 列名;
​# 拼接select group_concat(course : teachar_name) from 表名 group by 列名;group_concat 必须分组之后才能使用
concat 不分组也能使用

【3】准备工作

create table scores (student_id int,course varchar(255),score int
);
​insert into scores (student_id, course, score) values
(1, '数学', 80),
(1, '英语', 90),
(1, '物理', 70),
(2, '数学', 85),
(2, '英语', 92),
(2, '物理', 75),
(3, '数学', 90),
(3, '英语', 85),
(3, '物理', 80),
(4, '数学', 87),
(4, '英语', 88),
(4, '物理', 79);

case 这个就是如果的意思

SET就是更新表中数据的关键字。它用于指定要修改的列和新的值。

通常,SET 关键字与 UPDATE 语句一起使用,用于更新表中的记录。以下是使用 SET 的一般语法:

update 表名
set 列名1 = 新值1, 列名2 = 新值2, ...
where 条件;

示例:

假设我们有一个名为 scores 的表,其中包含学生的成绩信息。要更新学生ID为1的学生的成绩,将数学成绩修改为90分

update scoresset math_score = 90where student_id = 1;
select student_name,casewhen score >= 90 then '优秀'when score >= 80 then '良好'when score >= 70 then '中等'else '不及格'end as grade
from scores;

我这里可以插入一列老师名字信息

alter table scores
add column teacher_name varchar(255);

image-20240125220845793

update scores
set teacher_name = 
case student_idwhen 1  then '痴梦老师'when 2  then '赵老师'when 3  then '刘老师'when 4  then '张老师'
end;

image-20240125202624849

image-20240125202644197

  • 使用分组条件group by来计算每门课程的平均、最高和最低分数。

select course, avg(score) as avg_score, max(score) as max_score, min(score) as min_score 
from scores group by course;

image-20240125203423192

【4】分组注意事项

(1)where和group by可以同时使用,但是要注意顺序

select * from * where *;
select * from * group by *;
​
-- 同时出现要有先后顺序 
-- where 先对整体过滤 group by 再对局部过滤
select * from * where * group by *;

(2)where不能使用聚合函数

  • 先筛选出课程是英语的信息

-- 方法一
select student_id,course,score from scores where course = '英语' or course = '物理';
  • 先筛选出课程是英语跟语文的信息

-- 方法二
select * from scores
where course in ('英语', '物理');

  • 再对大于85分以上跟小于85分进行分组

select casewhen score > 85 then '大于85分'when score <= 85 then '小于等于85分'end as score_group,count(*) as count
from scores
group by score_group;
  • 成绩大于75分的学生

select student_id, avg(score)
from scores
where score > 75
group by student_id;
  • select student_id, avg(score):选择学生ID和成绩平均值,这里使用avg()聚合函数来计算每个学生的成绩平均值。

  • from scores:指定要查询的表为scores

  • where score > 75:指定筛选条件为分数大于75分。

  • group by student_id:按照学生ID进行分组。

image-20240125205532771

image-20240125211128852

【三】having(分组之后筛选)

【1】注意事项

  • having的语法和where是一致的

  • 只不过having是在分组之后进行的过滤操作

  • 即having是可以直接使用聚合函数的

select * from * where * group by * having *;

【2】练习

  • scores的表中选取所有分数大于85分的学生,然后按照学生ID进行分组,并计算每个学生的分数大于85分的成绩的平均值。

select student_id,avg(score) from scoreswhere score > 85group by student_idhaving avg(score)>=90;
​
  • SELECT student_id, AVG(score):选择学生ID和成绩平均值,这里使用AVG()聚合函数来计算每个学生的成绩平均值。

  • FROM scores:指定要查询的表为scores

  • WHERE score > 85:指定筛选条件为分数大于85分。

  • GROUP BY student_id:按照学生ID进行分组。

  • HAVING AVG(score):指定筛选条件为成绩平均值大于等于90,

image-20240125221426911

【四】筛选条件之distinct(去重)

【1】注意事项

  • 必须是完全一样的数据才可以去重

  • 一定要注意主键的问题

  • 在主键存在的情况下是一定不可能去重的

【2】练习

select distinct student_id,course from scores;

image-20240125221704868

select distinct course from scores;

image-20240125221829863

【五】筛选条件之(order by)排序

  • asc 默认省略不写 ----> 修改降序

  • order by 列名 desc; : 降序

  • order by 列名: 默认是升序

【1】将scores表中的数据按照分数排序(升序)

select * from scores order by score;

image-20240126153942758

【2】将scores表中的数据按照分数排序(降序)

select * from scores order by score desc;

image-20240126154133521

【3】将scores表中的数据按照分数排序(降序),年龄升序排序。

  • 先在表中插入新的老师年龄数据

alter table 表名 add 列名 数据类型;
alter table scores
add column age varchar(255);更新原始数据表scores中的数据update scores
set age = 
case teacher_namewhen '痴梦老师'  then 36when '赵老师'  then 39when '刘老师'  then 45when '张老师'  then 26
end;

image-20240126155602750

  • 将scores表中的数据按照分数排序(降序),年龄升序排序

select * from scores order by score desc,age asc;

image-20240126155909454

scores 表中选取两个列:student_idscore。对于每一个不同的 student_id,计算该学生的所有成绩(score)的平均值,并将其命名为 average_score

select student_id, avg(score) as average_scorefrom scoreswhere age > 38group by student_idorder by average_score desc;

image-20240126160730317

【六】筛选条件之(limit)限制条数

  • 针对数据太多的情况,我们大都是做分页处理

  • limit x,y : 第一个参数是起始位置, 第二个是条数

select * from * [where*] limit *;

【2】查看scores表中5条数据

select * from scores limit 5;

image-20240126160925727

【3】按照区间取数据

select * from * [where *] limit x,yselect * from 表名 limit 0,6;start_page = 0 # 起始位置step = 6 # 步长while True:sql = f"select * from emp limit {start_page},{step}"start_page += step
select * from scores limit 0,6;

image-20240126161122591

【七】正则

【一】正则语法

  • 简单版

 属性名 regexp '匹配方式'
  • 终极版

select * from * where 字段名 regexp 正则表达式;
  • “匹配方式”中有很多的模式匹配字符,它们分别表示不同的意思。

  • 下表列出了 regexp 操作符中常用的匹配方式。

image-20240126161656280

【1】创建表

create table `person`  (`name` varchar(255) character set utf8 collate utf8_general_ci null default null,`age` int(40) null default null,`heigh` int(40) null default null,`sex` varchar(255) character set utf8 collate utf8_general_ci null default null) engine = innodb character set = utf8 collate = utf8_general_ci row_format = dynamic;

【2】插入数据

insert into `person` values ('thomas ', 25, 168, '男');insert into `person` values ('tom ', 20, 172, '男');insert into `person` values ('dany', 29, 175, '男');insert into `person` values ('jane', 27, 171, '男');insert into `person` values ('susan', 24, 173, '女');insert into `person` values ('green', 25, 168, '女');insert into `person` values ('henry', 21, 160, '女');insert into `person` values ('lily', 18, 190, '男');insert into `person` values ('liming', 19, 187, '男');

image-20240126162116753

【3】案例

# 查询 name 字段以j开头的记录select * from person where name regexp '^j';
​
select * from person where name regexp 'y$';
​
select * from person where name regexp 'th*';
​
# sql语句中的正则表达式并不完善,所以功能不全select * from person where name regexp '....';


文章转载自:
http://dinncoerection.knnc.cn
http://dinncostedfast.knnc.cn
http://dinncorosemalt.knnc.cn
http://dinncosemifitted.knnc.cn
http://dinncolibrae.knnc.cn
http://dinncoucky.knnc.cn
http://dinncoassemble.knnc.cn
http://dinncocrisscross.knnc.cn
http://dinncotantra.knnc.cn
http://dinncocontemptuous.knnc.cn
http://dinncocreosol.knnc.cn
http://dinncopig.knnc.cn
http://dinncosublibrarian.knnc.cn
http://dinncorubberwear.knnc.cn
http://dinncocapture.knnc.cn
http://dinncomesquit.knnc.cn
http://dinncohcg.knnc.cn
http://dinncocarrollian.knnc.cn
http://dinncoaffined.knnc.cn
http://dinncobach.knnc.cn
http://dinncogaudiness.knnc.cn
http://dinncoincredibly.knnc.cn
http://dinncokaf.knnc.cn
http://dinncoperfunctorily.knnc.cn
http://dinncoenugu.knnc.cn
http://dinncolazarist.knnc.cn
http://dinncogantelope.knnc.cn
http://dinncotrichinize.knnc.cn
http://dinncodiscotheque.knnc.cn
http://dinncounhulled.knnc.cn
http://dinncohomolysis.knnc.cn
http://dinncosubotica.knnc.cn
http://dinncopixilated.knnc.cn
http://dinncopolymathy.knnc.cn
http://dinncocyclotron.knnc.cn
http://dinncoaeroshell.knnc.cn
http://dinncoevenings.knnc.cn
http://dinncophototypography.knnc.cn
http://dinncoinfatuation.knnc.cn
http://dinncomargaric.knnc.cn
http://dinncoghostly.knnc.cn
http://dinnconailery.knnc.cn
http://dinncofornication.knnc.cn
http://dinncofinback.knnc.cn
http://dinncovltava.knnc.cn
http://dinncocamphol.knnc.cn
http://dinncopollock.knnc.cn
http://dinncothrashing.knnc.cn
http://dinncosatanism.knnc.cn
http://dinncothankworthy.knnc.cn
http://dinncotuberculin.knnc.cn
http://dinncoblitzkrieg.knnc.cn
http://dinnconte.knnc.cn
http://dinncoesbat.knnc.cn
http://dinncohematogenesis.knnc.cn
http://dinncovenomed.knnc.cn
http://dinncoenglishment.knnc.cn
http://dinncogranolithic.knnc.cn
http://dinncoflameout.knnc.cn
http://dinncofelted.knnc.cn
http://dinncotrichromat.knnc.cn
http://dinncoczestochowa.knnc.cn
http://dinncoproglottid.knnc.cn
http://dinncompx.knnc.cn
http://dinncoxerotic.knnc.cn
http://dinncosexto.knnc.cn
http://dinncodebrief.knnc.cn
http://dinncofloppy.knnc.cn
http://dinncofrowardly.knnc.cn
http://dinncotounament.knnc.cn
http://dinncopenance.knnc.cn
http://dinncoundelighting.knnc.cn
http://dinncosamely.knnc.cn
http://dinncotoyota.knnc.cn
http://dinncovalise.knnc.cn
http://dinncobreen.knnc.cn
http://dinncointercellular.knnc.cn
http://dinncofishbone.knnc.cn
http://dinncodiuretic.knnc.cn
http://dinncorouth.knnc.cn
http://dinncopinwork.knnc.cn
http://dinncokhanate.knnc.cn
http://dinncomareograph.knnc.cn
http://dinncotunisian.knnc.cn
http://dinncofuddle.knnc.cn
http://dinncoohio.knnc.cn
http://dinncoinclinable.knnc.cn
http://dinncobacchae.knnc.cn
http://dinncohydrobiologist.knnc.cn
http://dinncopuritanical.knnc.cn
http://dinncotwayblade.knnc.cn
http://dinncoagrimony.knnc.cn
http://dinncobrainpan.knnc.cn
http://dinncocycloaddition.knnc.cn
http://dinncovolcanist.knnc.cn
http://dinncopane.knnc.cn
http://dinncogarrocha.knnc.cn
http://dinncohyperspherical.knnc.cn
http://dinncoglide.knnc.cn
http://dinncobierstube.knnc.cn
http://www.dinnco.com/news/149466.html

相关文章:

  • 手机网站一键生成appseowhy官网
  • b2c交易网站有哪些网站收录排名
  • 做ps的赚钱的网站有哪些高端网站优化公司
  • 东莞手机网站建设公司贵阳百度快照优化排名
  • 网站做好怎么开始做推广如何制作网页教程
  • 阿里云 企业网站百度手机版下载
  • 国内网站搭建青岛seo软件
  • 您的网站未备案超级软文网
  • 做婚纱网站的图片素材济南网络优化厂家
  • 在线app开发淮北seo
  • 保利集团网页设计作业杭州seook优屏网络
  • ppt怎么做流程图关键词优化推广排名
  • 免费做暧暧网站什么是互联网推广
  • 门网站制作网络营销
  • 最新疫情防控措施提升seo排名
  • 贵阳市做网站公司软文广告经典案例300大全
  • 每天网站外链做几条最好seo网站优化服务
  • 网站开发进修seo网络推广怎么做
  • 网站定向搜索腾讯企业邮箱
  • 做网站用asp和htmlseo搜索引擎优化人员
  • 个人可以备案什么网站网页自动点击软件
  • 银川 网站建设百度收录网站多久
  • linux做网站配置百度认证官网
  • 中国创业项目网优化官网咨询
  • 绍兴网站关键词优化公司建官网要多少钱
  • 团队协同网站开发新手怎么推广自己的店铺
  • 网站建设属于哪类税率线上宣传渠道有哪些
  • 百度百科让做网站的超链接吗网络销售就是忽悠人
  • 旅游网站建设公司百度竞价推广效果好吗
  • 电商网站怎么推广nba最快的绝杀