zoukankan      html  css  js  c++  java
  • 关于Django中操作MySQL数据库常用语句

    1、

    https://blog.csdn.net/weixin_44014981/article/details/84888718

    2、

    https://blog.csdn.net/weixin_34752204/article/details/115063405

    3、

    https://blog.csdn.net/ithongchou/article/details/104436711?utm_medium=distribute.pc_relevant_download.none-task-blog-2~default~blogcommendfrombaidu~default-1.nonecase&depth_1-utm_source=distribute.pc_relevant_download.none-task-blog-2~default~blogcommendfrombaidu~default-1.nonecas

    distinct()具有去重功能,distinct()函数有一个隐藏特性,当使用distinct()函数的时候,如果不使用order_by()函数做跟随,那么该函数会自动把当前表中的默认排序字段作为DISTINCT的一个列。

    ContentType 表名
    values(‘app_label’).distinct() 去重字段
    order_by(‘app_label’) 排序字段

    ContentType.objects.values(‘app_label’).distinct().order_by(‘app_label’)

    values(‘userName’).distinct() 去重字段
    order_by(‘score’) 排序字段

    GradingModels.objects.values('userName').distinct().order_by('score')
    4、

    5、

  • 相关阅读:
    24/3=8 睡觉8工作8 8????
    linux上使用redis--宝塔面板
    Ruby--strftime
    JS-页面操作
    JS-确认框
    Rails--bundle exec rake db:migrate
    Jquery--array
    Ruby--hash
    Jquery--string
    Jquery--ajax
  • 原文地址:https://www.cnblogs.com/yaok430/p/14649070.html
Copyright © 2011-2022 走看看