• tp5总结(四)


    数据库

    1.数据库配置

    1-1.配置文件配置【http://ww:7070/tp5-3/public/】

    1-2.Db::connect配置【数组和字符串方式】【http://ww:7070/tp5-3/public/index/index/db1和http://ww:7070/tp5-3/public/index/index/db2】

    1-3.model配置【数组和字符串方式】【http://ww:7070/tp5-3/public/admin】

    2数据库普通链接

    2-1.普通查询两种【http://ww:7070/tp5-3/public/index/test/test1和http://ww:7070/tp5-3/public/index/test/test2】【返回查询结果】

    2-2.普通插入三种【http://ww:7070/tp5-3/public/index/test/test3和4和5】【返回影响的条数】

    注意:Db::getLastSql()可以获取sql语句

    2-3.普通删除三种【http://ww:7070/tp5-3/public/index/test/test6】【返回影响条数】

    2-4.普通更新三种【http://ww:7070/tp5-3/public/index/test/test7】【返回影响条数】

    3.常用方法

    3-1.where限制条件【http://localhost:7070/tp/public/admin/sql/awhere1或awhere2和awhere3】

    3-2.order升降序【http://localhost:7070/tp/public/admin/sql/aorder】

    3-3.limit限制上限和分页【http://localhost:7070/tp/public/admin/sql/alimit1和http://localhost:7070/tp/public/admin/sql/alimit2】

    3-4.group分组以及获取最大最小总量平均值 字段重命名【http://localhost:7070/tp/public/admin/sql/agroup】

    3-5.having对于分组查询的结果进行筛选【http://localhost:7070/tp/public/admin/sql/ahaving】

    3-6.join联动查询【http://localhost:7070/tp/public/admin/sql/ajoin】

    3-7.union查询多个表,返回一个包含所有结果的数组【http://localhost:7070/tp/public/admin/sql/aunion】

    3-8.distinct只会返回不重复的值【http://localhost:7070/tp/public/admin/sql/adistinct】

    3-9.聚合查询【avg,count,max,min,sum】

    4.事务机制

    4-1.主动控制【http://localhost:7070/tp/public/admin/sql/event1】

    4-2.手动控制【http://localhost:7070/tp/public/admin/sql/event2】

  • 相关阅读:
    svn的安装方法
    在powerDesigner中通过SQL生成pdm
    关于文件下载
    关于ClassPath的思考
    重读Spring之ConfigurationClassPostProcessor-改正错误
    SpringBoot自动装配原理
    SpringMVC之json是怎么传回前端的 @ResponseBody解析
    consumer配置参数之max.poll.interval.ms
    SpringMVC 之处理请求
    使用SpringMVC遇到的坑
  • 原文地址:https://www.cnblogs.com/douyaer/p/8109916.html
Copyright © 2020-2023  润新知