- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How will you find the ORDER_ID of all the orders having ORDER_TOTAL greater than the average of ORDER_TOTAL in ORDER's DB2 table
We can find all the ORDER_ID which are having ORDER_TOTAL greater than the average value of all the ORDER_TOTAL present in the ORDERS table using the sub-query.
For example, if we have below ORDERS table.
Below is the subquery to find out the desired data.
SELECT ORDER_ID, ORDER_TOTAL FROM ORDERS WHERE ORDER_TOTAL > (SELECT AVG(ORDER_TOTAL) FROM ORDERS)
The result of the above query will be as below.
- Write the DB2 SQL query to find the third highest ORDER_TOTAL in a ORDERS DB2 table
- How will you create a new TRIGGER on the ORDERS DB2 table? Give the syntax of TRIGGER
- Write a DB2 query to find out all the duplicate INVOICE_ID in ORDERS DB2 table?
- How will you find out all the indexes which are built in a particular DB2 table?
- How to find all the foreign keys of a DB2 table TAB1?
- How can you revert all the DB2 table changes done in a COBOL-DB2 program?
- What's the meaning of the phrase 'what you seek is seeking you'?
- How will you detect the condition of the end of cursor rows in a COBOL-DB2 program?
- Write the syntax to declare a scrollable cursor on the ORDERS DB2 table.
- Python – Average of digit greater than K
- Count the number of words having sum of ASCII values less than and greater than k in C++
- Write a SQL query to count the number of duplicate TRANSACTION_ID in an ORDERS DB2 table
- How to get the list of all COBOL-DB2 programs using a DB2 table TAB1?
- Find the Number of segments where all elements are greater than X using C++
- How to find the primary key of a DB2 table TAB1?