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

数据库(部分函数)

函数:
     单行函数:会对查询中的每一数据进行处理
     字符函数
     length(列名)
     select name,
     
     日期函数:
     now()    年月日时分秒
     curdate() 年月日
     curtime()时分秒
     year(日期列)获取指定日期
     str_to_date(日期,格式)将指定日期格式化为规定格式
      select  str_to_date ('2014-1-1','%y-%m-%d') from表名
     datediff(curdate(),birthday)计算两个日期间相差的天数
     
     数学函数:
     select name ,gender, round(height),cell(1.1),floor(1.9)from 表名
     select name, gender, truncate(height,1),height,rand() from 表名 
     
     分组函数: 聚合函数 (查询多行返回一行),统计函数
     select sum (weight)from 表名(体重求和)
     select avg(height)from 表名(身高均值)
     select max/min (height) from 表名
     select count(*)from 表名(计数)
     
     条件查询
     select*from 表名 where条件
     select*from team where gender ='男' and height >1.80
     or 多个条件满足一个即可
     
     模糊查询
     select *from 表名 where 列名 like'关键字%' 
     eg: select *from team where name like'王%'
     
     in (值1,值2) from表名    再给定值中查找
     
     排序
     select*from 表名 where 条件 order by 列名 ASC    升序
     select*from team where number >0order by number DESC 降序
     一般默认升序
     
     数量限制
     limit:对查询的显示结果限制数目
     select *from student where number >0 order by number ASC limit 0,3
     从第0行,检索到第3行
     
     分组处理:一般根据性别,年龄,职业等不同条件加以限制
     把满足某一个条件的数据分到同一个组中,每个组内单独进行处理 
     select count(*),gender from 表名 group by gender 根据男女性别分组
     
     having count(*)>2     having 条件  是u低分组后的结果进行条件筛选
     
     

http://www.lryc.cn/news/266819.html

相关文章:

  • 基于Vite+Vue3 给项目引入Axios
  • 为什么查企业的时候有的公司没有显示注册资金?
  • DataProcess-VOC数据图像和标签一起进行Resize
  • MultiValueMap
  • 山西电力市场日前价格预测【2023-12-25】
  • 【华为OD机试真题2023CD卷 JAVAJS】5G网络建设
  • OSI 七层参考模型及TCP/IP 四层模型
  • 【面向对象】对比JavaScript、Go、Ada、Python、C++、Java、PHP的访问限制。
  • 力扣(leetcode)第26题删除有序数组中的重复项(Python)
  • 【内存泄漏】内存泄漏及常见的内存泄漏检测工具介绍
  • FPGA-ZYNQ-7000 SoC在嵌入式系统中的优势
  • 如何在Vue3中实现无缝热重载:提升你的开发效率
  • 盒子 Box
  • uni-app附件下载预览 并解决打开附件时黑屏
  • 卸载了Visual Studio后,在vscode中执行npm i或npm i --force时报错,该怎么解决?
  • 渗透测试 | 信息收集常用方法合集
  • 使用 ElementUI 组件构建无边框 Window 桌面应用(WinForm/WPF)
  • JavaScript中数组的方法和函数作用域问题
  • nodejs设置x-xss-protection解决xss问题
  • C/C++不同整数类型的区别
  • 如何理解JDK、JRE、JVM区别与联系
  • 用友GRP-U8 SmartUpload01 文件上传漏洞
  • react 路由v6
  • rpc【通义】rpc原理【gpt】
  • Leetcode 2973. Find Number of Coins to Place in Tree Nodes
  • 如何调动销售人员使用CRM的积极性?
  • 数值分析期末复习
  • k8s的探针
  • Python 爬虫之下载视频(五)
  • Gradle下载地址