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

桌子上做嗯啊干爹网站站长工具seo综合查询源码

桌子上做嗯啊干爹网站,站长工具seo综合查询源码,前端网站重构怎么做,开通独立网站Dml语句 对数据的增删改查 关键字 Insert增 Update删 Delete改 添加数据 给指定字段添加数据 Insert into 表明 (字段名1,字段名2) values(值1,值2); 给全部字段添加数据--(根据位置对应添加到字段下) Insert into 表名 values…

Dml语句 对数据的增删改查

关键字

Insert增

Update删

Delete改

添加数据

给指定字段添加数据

Insert into 表明 (字段名1,字段名2) values(值1,值2);

给全部字段添加数据--(根据位置对应添加到字段下)

Insert into 表名 values(值1,值2);

添加多条数据--(一次添加两条)

Insert into 表名 values (值1,值2),(值1,值2);

修改数据---不带where则所有的字段更改

                                           唯一值作为条件-id

Update 表名 set 字段名=1 ,字段名=2 .... where 条件

Updae usertable set name=”王五” where id = 1 ;

根据条件删除  ---不携带where则删除表里所有数据

delete from 表名 where 字段=值

DQL--数据库查询语言

关键字 select

 

# 创建表
create table userTable (
    id int comment '唯一值',
    workno varchar(10) comment '工号',
    name varchar(50) comment '姓名',
    gender char(1) comment '性别',
    age tinyint comment '年龄',
    idcard varchar(18) comment '身份证号',
    worknoaddress varchar(50) comment '工作地址',
    entrydate date comment '入职时间'
) comment '员工表';

# 查询当前表 所有字段 字段值类型  默认值等
desc usertable;

# 批量添加           字段                                                    值
insert into userTable(id, workno, name, gender, age, idcard, worknoaddress, entrydate)
values (1,'1','柳岩','女',18,'123123123123123123','武汉','2023-6-26'),
       (2,'2','张无忌','男',20,'123123123123123123','天龙八部','2022-7-26'),
       (3,'3','韦一笑','男',18,'123123123123123123','天龙八部','2021-7-26'),
       (4,'4','周芷若','女',25,null,'天龙八部','2023-7-26'),
       (5,'5','谢逊','男',88,'12312312312312312x','天龙八部','2023-3-26'),
       (6,'6','张三丰','女',100,'123123123123123123','天龙八部','2023-2-26'),
       (7,'7','刘亦菲','女',18,'123123123123123123','武汉','2023-7-26')
       ;




# 查询
select * from usertable;


# ------查询需求------------------------DQl基础查询------

# 基本查询
# --1.查询指定字段-name workon age
select name ,workno,age from userTable;

# 2.查询所有字段返回
select  * from userTable;

# 3.查询所有员工得工作地址,起别名

select worknoaddress as '工作地址' from userTable;

#4查询公司员工得上班地址(不重复)
select distinct worknoaddress from userTable;

# ----------DQL语法条件查询-------------
#  > < >= <= = <>或!=(不等) BETWEEN...AND(在某个范围内含最小,最大)
# IN(...) 在in之后的列表中的值,多选一
# LINK 占位符 模糊匹配( _ 匹配单个字符, % 匹配任意个字符)
# IN NULL 是null
# AND或&& 并且
# OR或|| 或
# NOT 或 !
# 语法 SELECT 字段 from where 条件列表

# 1查询年龄=88的员工
select * from userTable where age = 88;

# 2查询年龄小于20
select * from userTable where age < 20;

# 3查询年龄小于等于20
select * from userTable where age <= 20;

# 4查询没有身份证号的
select * from userTable where idcard is null ;

# 5查询有身份证号的
select * from userTable where idcard is not null ;

# 查询名字是两位的
select * from userTable where name like'__';

# 查询身份证号后带x的
select * from userTable where idcard like '%x';

# 查询15-20的人
select * from userTable where age >=15 && age <= 20 ;
select * from userTable where age between 15 and 20 ;


# 与
select * from userTable where gender='女' && age = 18;
# 或
select * from userTable where age >= 900 || gender = '男';
# 非
select * from userTable where gender != '男';

# -------------DQL聚合函数---将列数据做为整体,进行纵向计算----------------
# count 统计数量
# max 最大
# min 最小
# sum 求和
# avg 平均值

# 语法
# select 聚合函数(字段)from 表名

# ** --null 值不参与聚合函数计算

# 统计员工数量
select count(*)from userTable;

# 统计员工平均年龄
select avg(age)from userTable;

# 统计最大年龄
select max(age) from userTable;

# 统计最小年龄
select min(age)from userTable;

# 统计天龙八部地区所有员工年龄之和
select sum(age) from userTable where worknoaddress = '武汉';


# ------分组查询-----------------
# 语法 select 字段列表 from 表名 [where 条件] GROUP BY 分组字段名 [having 分组后过滤条件]

# **--- where 是对分组前进行过滤   ,having 是分组后进行过滤
# **--- where不能对聚合函数进行判断,而having可以

# 分组查询
# 根据性别分组,统计男性员工  和 女性员工的数量
select count(*) from userTable group by gender;

select gender, count(*) from userTable group by gender;

# 根据性别分组,统计男性  和 女性员工的平均年龄
select avg(age) from userTable group by gender;
select gender , avg(age) from userTable group by gender;

# 查询年龄小于45员工,并根据工作地址分组,获取员工数量大于等于3的工作地址

# --where 过滤聚合函数之前数据    得到<45数据   分组 统计地址数据    对分组数据过滤 >=3的
select worknoaddress , count(worknoaddress) from userTable where age < 45 group by worknoaddress having count(worknoaddress) >= 3 ;

# --年龄小于45  地址  分组  统计
select worknoaddress , count(worknoaddress) from userTable where age < 45 group by worknoaddress ;

# ---********总结重点 执行优先级  where > 聚合函数  > having
# ***---分组之后,查询的字段一般为聚合函数和分组字段查询,查询其他字段无任何和意义

http://www.dt0577.cn/news/21648.html

相关文章:

  • 网站建设策划 流程图移动网站推广如何优化
  • 沈阳整站优化关键词排名零芯互联排名
  • 郑州做网站哪个平台好直通车推广
  • 做蛋糕招聘网站网站建设方案书范文
  • 电器网站建设app软件下载站seo教程
  • 天津网站优化哪家快b站推广软件
  • 做网站网络公司无收入培训机构是干什么的
  • 做面料那几个网站四川seo整站优化吧
  • 外贸一站式推广服务网球新闻最新消息
  • 网站设计 线框图 怎么画互联网营销策划方案
  • 网站推广服务报价表广州宣布5条优化措施
  • 哪些网站做兼职可靠seo网站优化报价
  • 如何做旅游网站推销百度在线使用网页版
  • vs2015网站开发郑州seo博客
  • 网页模板下载 免费 html哈尔滨百度网站快速优化
  • 甘肃企业网站建设长尾关键词排名工具
  • 宁德城乡建设网站网推拉新app推广接单平台
  • 网站域名备案查询网站收录
  • 做论坛网站如何赚钱seo研究中心官网
  • 免费的公文写作网站seo方案
  • ashx做网站灰色词排名代做
  • 小说网站开发l成都网络推广公司
  • 番禺网站开发服务新手seo要学多久
  • 一家专门做鞋子的网站百度关键词刷排名教程
  • 为什么不用原来的网站做推广写文的免费软件
  • 网站工程师培训价格域名注册需要什么条件
  • 徐州党廉政建设网站怎样免费建立自己的网站
  • 泰安网站设计公司广州网站营销seo
  • 怎样做一个购物型的网站seo搜索引擎优化试题及答案
  • 商务网站建设实训结论网络营销的策略有哪些