Skip to content

Tag: mysql

How to get calculated data from one column in database

im new in sql. I cannot get data with format what i want in one step. Now i’m using more sql commands. I want to get all data in one command because i cant to connect them in subquery with group by. Somebodys can help me? example of Table i have: id order_id order_status 1 1 0 2 1 0

Percentage based on another column, with group by

This is what I have: getting this one: I want to have additional column, telling me per day how much is my success rate. E.g. 210/(210+40) for day 5, 40/(32+40) for day 6 etc: Answer This way you can get the rates (success/failure) for equivalent status type. Output:

The Sum of people that have same age in SQL?

I’m taking a SQL class and I need help with a question. I have the following table on a phpmyadmin server with a total of 100 patients I’m told to find the sum of people that have same age using SQL. I wrote this query: but it returns 100 as a result and when I did this query and found

Group by the specific day, month, and year

I have a table as follow, now I use the group by date and it only group my data based on the year. I want to group the data based on the specific day, month, and year. Do you know how we can do that? Answer Use: Check for more info