how to Update table Sales_summary with max(sales) data from
table sales_dataTable 1. sales_data table Table 2.
Sales_summary
Region sales Region sales
N 500 N 0
N 800 W 0
N 600
W 899
W 458
W 900
I want the Sales_summary After Update like this
Region Sales
N 800
W 900
Answer Posted / krishna
SQL> desc a;
Name Null? Type
------------------------------- -------- ----
A VARCHAR2(2)
B NUMBER(3)
SQL> select * from a;
A B
-- ---------
N 500
N 800
N 600
W 899
W 458
W 900
6 rows selected.
SQL> desc b;
Name Null? Type
------------------------------- -------- ----
A VARCHAR2(2)
B NUMBER(3)
SQL> select * from b;
no rows selected
SQL> insert into b (select a, max(b) from a group by a);
2 rows created.
SQL> select * from b;
A B
-- ---------
N 800
W 900
SQL>
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
how to convert character strings to numeric values? : Sql dba
- Types of triggers - View - Dcl - Procedures, packages, functions - Metasolve - Can use Dcl in triggers - package case study - Cursor and its types - triggers schedule - Wrap - Why we are using fetch and for in cursor. difference?
What is case function?
How to get help at the sql prompt?
How can we connect an Android App to an Oracle database and use the PL/SQL procedural code?
What has stored procedures in sql and how we can use it?
What is normalization? How many normalization forms are there?
What is the maximum number of columns in sql table?
How is data stored in sql?
What are pl/sql cursors?
How do you explain an index number?
what are the features and advantages of object-oriented programming? : Sql dba
What is the syntax and use of the coalesce function?
What is nosql example?
What are reports usually used for?