• 语句、聚合函数、数学函数、字符串函数、时间日期函数


     
    --添加列
    alter table shuiguo add price decimal(18,2)
    --删除列
    alter table shuiguo drop column price

    --更改数据库的名称,逗号前面是之前的,逗号后是要改成的名字 sp_renamedb student,xuesheng

    更改数据库的名称

    表中有数据的情况下再添加列、删除列

    语句示例

    --查询所有数据
    select * from xuesheng
    --查询开头是王的所有数据
    select * from xuesheng where name like '王%'
    --查询语文最高分
    select top 1 * from xuesheng order by yuwen desc
    --查询叫王三的语文、数学分数
    select yuwen,shuxue from xuesheng where name='王三'
    --查询语文分数在50到70学生的所有数据
    select * from xuesheng where yuwen between 50 and 70

    语句示例:

    模糊查询的语句:

    排序语句

    聚合函数:sum、avg、max、min、count

    使用方法示例:

    group by 分组的使用方法

    分组的练习:

    数学函数:ABS、ceiling、floor、power、round、sqrt、square

    数据库的简单查询练习:

    字符串函数:

    时间日期函数:

    数据转换、函数转换

  • 相关阅读:
    linux 时间设置
    linux
    linux 关闭防火墙
    GIS-008-ArcGIS JS API 全图
    GIS-007-Terrain跨域访问
    GIS-006-ArcGIS API 空间关系
    Python 中文乱码
    GIS-005-Dojo & jQuery 事件处理
    GIS-004-Cesium版权信息隐藏
    GIS-003-在线地图下载及应用
  • 原文地址:https://www.cnblogs.com/wy1992/p/6069809.html
Copyright © 2020-2023  润新知