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 913237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:31:24+00:00 2026-05-15T17:31:24+00:00

Two days ago I was asked this question in an interview for Data Analyst

  • 0

Two days ago I was asked this question in an interview for Data Analyst position. Could some one please let me know the correct answer for this?

Say there is a single table with three columns.

  • 1st column with GeneId(primary key)
  • 2nd column Flag1,
  • 3rd column Flag2.

Flag1 and Flag2 columns can have values of 0 or 1. How do I write a single SQL query in which I get the count of GeneIds for different combinations of Flag1,Flag2 possible, i.e. Flag1 0, Flag2 1, Flag1 1, Flag2 0, ….& other combinations.

Thanks for your time,

Regards
Sashi

  • 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-05-15T17:31:25+00:00Added an answer on May 15, 2026 at 5:31 pm
    SELECT Flag1, Flag2, COUNT(GeneId) as NumGenes
    FROM genetable
    GROUP BY Flag1, Flag2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I asked a pretty similar question a few days ago, but this one is
Two days ago I wrote this question: How can I retrieve an object on
This post is closely related to another one I posted some days ago .
I need query to get data between two days.I tried with this.But it gives
Guys I've asked few days ago a question and didn't have really time to
I'm getting an error on some code that two days ago was running fine.
I'm raising this question because of another question I asked here on SO some
As an addon to the question I asked a few days ago here at
Now this is a weird problem. I was coding two days ago and stopped
Update I asked this question quite a while ago now, and I was curious

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.