Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8919755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:06:18+00:00 2026-06-15T06:06:18+00:00

Here is my BigQuery SELECT word,word_count,corpus_date FROM [publicdata:samples.shakespeare] WHERE word=the ORDER BY word_count asc

  • 0

Here is my BigQuery

SELECT word,word_count,corpus_date FROM 
[publicdata:samples.shakespeare] 
WHERE word="the" ORDER BY word_count asc

which gives output as

    Row word    word_count corpus_date   
    1   the       57       1609  
    2   the       106      0     
    3   the       287      1609  
    4   the       353      1594  
    5   the       363      0     
    6   the       399      1592  
    7   the       421      1611  

I want the data to be group by corpus_date.I tried using a group by corpus_date

    SELECT word,word_count,corpus_date FROM 
   [publicdata:samples.shakespeare] 
    WHERE word="the" group by corpus_date 
    ORDER BY word_count asc

but it did’nt allow me to do a group by corpus_date.Any way to get data grouped by corpus_date

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:06:19+00:00Added an answer on June 15, 2026 at 6:06 am

    You’ll need to GROUP BY all non aggregated values in your query. However, since you are simply looking for a single word, you don’t need to show or even GROUP BY that word in the result set (it’s implicitly selected using the word=”the” clause).

    Therefore, if you want the total sum of word counts for the word “the” grouped by date, you can run something like this:

    SELECT
      SUM(word_count) as sum_for_the,
      corpus_date
    FROM
      [publicdata:samples.shakespeare]
    WHERE
      word="the"
    GROUP BY
      corpus_date
    ORDER BY
      sum_for_the ASC;
    

    That’s not super useful on it’s own… so if you want to do something more involved, such as learn which corpus the count per date comes from, SUM the counts of the word and list the corpora using a query like this:

    SELECT
      SUM(word_count) AS sum_for_the, corpus, corpus_date
    FROM
      [publicdata:samples.shakespeare]
    WHERE
      word="the"
    GROUP BY
      corpus_date, corpus
    ORDER BY
      sum_for_the ASC;
    

    For listing all volumes that a word appeared in per year, I like to use the GROUP_CONCAT function. The word “the” appears in everything, so it’s probably not as interesting as a less common word, like “swagger.” (Which is one of many words invented by Shakespeare).

    SELECT
      SUM(word_count) AS word_sum, GROUP_CONCAT(corpus) as corpora, corpus_date
    FROM
      [publicdata:samples.shakespeare]
    WHERE
      word="swagger"
    GROUP BY
      corpus_date ORDER BY corpus_date ASC;
    

    Even more fun is to look at word prefixes, and GROUP BY variations of a word per volume and date:

    SELECT
      word, SUM(word_count) AS word_sum, GROUP_CONCAT(corpus) as corpora, corpus_date
    FROM
      [publicdata:samples.shakespeare]
    WHERE
      word CONTAINS "swagger"
    GROUP BY
      word, corpus_date
    ORDER BY
      corpus_date ASC
    IGNORE CASE;
    

    Check out the BigQuery Query Language reference and the BigQuery Cookbook for more examples.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to query sample datasets as here https://developers.google.com/bigquery/docs/sample-tables from a newly
Here is some output that I get from firebug <div id='div_undefined'>[{Region:AD,Date:,ArticleID:abc-345}, {Region:CD,Date:,ArticleID:abc-345}]</div> You can
Here is the script I'm using, copied directly from Google: <script type=text/javascript> var _gaq
Here is my json response {u'kind': u'bigquery#queryResponse', u'rows': [{u'f': [{u'v': u'1'}, {u'v': u'1607'}, {u'v':
I'm consistently getting this result back from BigQuery: { error: { errors: [ {
Here is the code in which i am having the problem- <!DOCTYPE html> <html>
The Google SQL syntax guide found here https://developers.google.com/bigquery/docs/query-reference does not seem to address use
I followed the tutorial here https://developers.google.com/bigquery/articles/dashboard#enablebigqueryapi and created a sample application to query Google
I'm following this tutorial https://developers.google.com/bigquery/articles/dashboard#downloadinstalllibraries Here they say that cd source/ enable-app-engine-project hellodashboard/ which
I am working on a Java application which uses Bigquery as the analytics engine.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.