Line no 4 and Line no 8 Output should be similar whereas both are different . Please need solution . Thank you [closed] - mysql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 days ago.
Improve this question
Screenshot of the problem provided
Was expenting output of Line 4 and Line 8 should be similar whereas experiencing difference .

Hard to tell without the source data, but I'm guessing that some students have a null for hrs_studied. Most aggregate functions skip nulls, but count(*) does not. If you replace the count(*) with a count(hrs_studied), you should get the same result as `avg(hrs_studied). I.e.:
SUM(hrs_studied) / COUNT(hrs_studied) AS agg_avg_study_time

Related

Comments getting removed on beautifying code in MySQL Workbench [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 days ago.
Improve this question
I am separating the comments from the code with 2 to 3 line break, but still it's getting removed.
How to fix this issue?
I have tried all the available comment syntaxes ( /**/, --, and # ), not all the comments are getting removed, but a few.

How to get a specific row of data for mysql with specification of company and agent [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
How to retrieve all the data pertaining to company name and agent from mysql? How to write the query statement?
Have you tried this?
SELECT *
FROM agent_info
WHERE policyCompany = 'Avia' and policyAgent = 'Ron';
I have to guess because you didn't tell us much about your tables, but this might work.
SELECT policyCompany,
GROUP_CONCAT(DISTINCT policyAgent ORDER BY policyAgent) agents
FROM mytable
GROUP BY policyCompany
You can read about GROUP_CONCAT() here.

How to get my substr result in multiple lines [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Hello I've a little question.
Here is my query :
select *
from (select substr(filename,1,30) from reports limit 1,1)query
In my reports table I've a row named filename (VARCHAR(300))
I'm looking to select the filename row but in 30 char max
I explain, my filename "a-long-file-name-with-more-30-chars.txt"
In want to 30 first chars in a line "a-long-file-name-with-more-30-" and the rest in another line "chars.txt"
Like this (It's an inspected element)
https://i.imgur.com/EMEyiWZ.png
Somethings like this https://stackoverflow.com/a/52722082/13304872
Thank you
to recover the first part
select substr(filename,1,30) from reports limit 1,1
the second part
select substr(filename,31) from reports limit 1,1

Displaying latecomers of staffs [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to display the list of staffs who check into work late in a week. For example the staff checks in at 8.10 when the supposed check in time is at 8.00 AM. I am using datetime for the datetimein and datetimeout field. Can anyone suggest how should I do it?
Well, with no sample tables to work from, it's hard to give a clear answer. But I think what you're looking for is the TIME() function.
This should get you started in the right direction:
SELECT * FROM timeclock_records where TIME(datetimein) > "08:00:00";

This is not a number Phpmyadmin [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Here im going to create a database in phpMyadmin.it shows this is not a number error.Here i have attached the image.When im going to save it shows
This is not a number!
You have to enter length for IsActive as it is of type BIT. In Mysql BIT field requires a length to be assigned.
For more details about Data types and their lengths , check out this page
http://www.tutorialspoint.com/mysql/mysql-data-types.htm
http://www.peachpit.com/articles/article.aspx?p=30885&seqNum=7