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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:13:32+00:00 2026-06-16T11:13:32+00:00

I have a table of students that has some data about whether or not

  • 0

I have a table of students that has some data about whether or not they attent a tutorial etc. There is an extract below.

|   id |   studentid | name |  present | 
|   1  |   111       | John |       1  | 
|   2  |   222       | Kate |       0  | 
|   3  |   333       | Matt |       1  | 
|   4  |   111       | John |       0  | 
|   5  |   111       | John |       1  | 

I can do a count to say when eg studentid=111 and present = 1 and when studentid=111 and present = 0.
But I can’t work out these two things.

i. Can I do just one count query rather than doing a seperate count for each?
Currently with my two seperate queries I am getting eg

studentid=111 and present = 1

| name |  present | 
| John |       12 | 

studentid=111 and present = 0

| name |  absent | 
| John |       4 | 

But I would ideally like

| name |  present |  absent | 
| John |       12 |       4 | 

ii.I want to see those students who have been to less than 75% of the classes. I have done some reading about the avg function however I am not sure how to implement something for this?

  • 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-16T11:13:33+00:00Added an answer on June 16, 2026 at 11:13 am

    To list the students that have been to less than 75% of classes:

    SELECT
      studentid,
      name, 
      SUM(present) AS present,
      SUM(present = 0) AS absent
    FROM your_table
    GROUP BY studentid, name
    HAVING present < .75 * (present+absent)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ihave a simple table that it has some record that There have been several
I have a table that looks like this for about ~30 students: StudentID Course*
I have an SQL table that links students to classes. This table primarily has
Suppose I have a data frame in R that has names of students in
I have on excel file that has the data of my student table. Now
I have a table that includes some student group name, lesson time, day names
I have a table full of attendance data for students, we are migrating to
I have a table, say STUDENTS, that is related one-to-many to another table, CLASSES.
I have a students table in my Oracle database which has a field called
I have a Relationship table that links teachers to students Teacher Student 1 1

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.