I have table named ‘marks’ which stores marks of students. I want to get the name of student who has highest total mark. I tried query like this But this is not working. Can anyone please help ? Answer get the max() total first then use a subquery
Tag: oracle
Filtering of records between sysdate and sysdate+7 from Oracle Sql is not working correctly
I am firing an SQL query to filter records between sysdate and sysdate+7 but I am getting records outside the range as well. What is wrong my SQL cursor.execute(“”” select ‘Shipment’ as …
Comparing group-by result with aggregated result
I am trying to retrieve details about stores where their average product prices are higher than the average of all stores in the table. So far, I have this code: select StoreID, count(ProductID) …
How to know the size of a table with a photo in Oracle
I have a table that I fill in the post method, I send a photo, and describe the event, I want to know the size of this table (MB) with the help of a selector, Someone can help me with this ?? SQL> …
How to display Max Date amount in another column?
I want to derive column MSP_ADULT and MSP_CHILD based on the LATEST date record ADULT_AMT to be in MSP_ADULT and CHILD_AMT to be in MSP_CHILD column. I want to my out like below. Here is the code I am running, but it is not working. Answer So you want the last values of those conditional MAX’s. Try FIRS…
Bizarre Oracle Error: ORA-00936: missing expression
I’m working with a large, complex query. I added a simple date filter to the WHERE clause, and now I get ORA-00936: missing expression Removing the rest of the query, and just selecting id with this single date filter still produces the error – so at least that narrows it down. Looking online, app…
What is Internal process of below mentioned queries?
As per performance which query is optimistic query? Answer id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra -: | :———- | :—- | :——— | :—– | :———— | :—— | :̵…
Syntax to resolve ORACLE error is ORA-01476: divisor is equal to zero
I’m using the NVL function to try and correct ERROR: Error fetching from cursor. ORACLE error is ORA-01476: divisor is equal to zero. I’m having trouble figuring out what the correct syntax is. Answer The normal method is nullif() in the dividend. So, instead of: You would use: Assuming that t.Amo…
AnalysisException: No matching function with signature: rtrim(VARCHAR(40), STRING)
I have the value of 58.3308% in the table(include % character), I need output of 0.583308, and the SQL query as below works fine in SQL console But I get this error in my python code, it’s a hive/impala problem, right? AnalysisException: No matching function with signature: rtrim(VARCHAR(40), STRING) Th…
How to list the most expensive and the cheapest item in each category in Oracle SQL?
So I need to get a list of categories and then get the most expensive item and then the cheapest item out of each category. Then I need to sort these categories by the sum of min and max price in ASC order. I’ve tried this: Now this partially works. It does give me a list of categories ordered, it