Jiyu
  • Blog
  • Dev
  • Leetcode
  • |
  • 中文

586. Customer Placing the Largest Number of Orders

April 28, 2022
sql

Customer Placing the Largest Number of Orders - LeetCode

Write an SQL query to find the customer_number for the customer who has placed the largest number of orders. The test cases are generated so that exactly one customer will have placed more orders than any other customer. The query result format is in the following example.


  • code
select top 1 customer_number from Orders group by customer_number order by count(*) desc
« 1050. Actors and Directors Who Cooperated At Least...
284. Peeking Iterator »
    array 93
    backtracking 20
    bfs 24
    bible 1
    binarysearch 27
    binarysearchtree 14
    binarytree 25
    bit 17
    china 5
    christian 5
    design 8
    dfs 30
    docker 2
    documentary 2
    dostoevsky 1
    dp 41
    dynalist 3
    flask 1
    graph 11
    greedy 16
    hashtable 22
    health 1
    heap 15
    hugo 3
    intellij 2
    java 8
    javascript 1
    leetcode-summary 13
    linkedlist 33
    linux 2
    math 33
    poetry 4
    psychology 4
    python 3
    queue 7
    recursion 6
    remix 1
    segmenttree 1
    slidingwindow 6
    sorting 11
    spring 8
    spring-in-action 4
    sql 12
    stack 23
    string 36
    tool 12
    topological 3
    travel 1
    tree 12
    trie 10
    twopointers 10
    unionfind 9
    vscode 2
    warwick 5
    wittgenstein 3