How to update a data for the views in the relational data
base schema

Answer Posted / poopapule

The UPDATE statement allows you to update a single record
or multiple records in a table.

The syntax for the UPDATE statement is:

UPDATE table
SET column = expression
WHERE predicates;



Example #1 - Simple example

Let's take a look at a very simple example.

UPDATE suppliers
SET name = 'HP'
WHERE name = 'IBM';

This statement would update all supplier names in the
suppliers table from IBM to HP.



Example #2 - More complex example

You can also perform more complicated updates.

You may wish to update records in one table based on values
in another table. Since you can't list more than one table
in the UPDATE statement, you can use the EXISTS clause.

For example:

UPDATE suppliers
SET supplier_name = ( SELECT customers.name
FROM customers
WHERE customers.customer_id = suppliers.supplier_id)
WHERE EXISTS
( SELECT customers.name
FROM customers
WHERE customers.customer_id = suppliers.supplier_id);

Whenever a supplier_id matched a customer_id value, the
supplier_name would be overwritten to the customer name
from the customers table.



-pooja papule

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to set fixed width in particular in html? if i type more character in this it will not push near . this is my question. can u tell me the answer...

2049


SELECT A~FTRMI A~AUFNR B~MATNR D~MAKTX B~PSMNG B~WEMNG C~MTART E~CHARG C~MATKL C~SPART R~BWART R~CHARG R~MATNR E~BWART R~BDMNG INTO TABLE ITAB FROM AFKO AS A INNER JOIN AFPO AS B ON A~AUFNR = B~AUFNR * INNER JOIN AFVC AS A1 ON A~AUFPL = A1~AUFPL AND B~DWERK = A1~WERKS INNER JOIN MARA AS C ON B~MATNR = C~MATNR INNER JOIN MAKT AS D ON C~MATNR = D~MATNR INNER JOIN MSEG AS E ON B~MATNR = E~MATNR AND A~AUFNR = E~AUFNR AND B~DWERK = E~WERKS INNER JOIN RESB AS R ON A~AUFNR = R~AUFNR AND E~AUFNR = R~AUFNR AND R~RSNUM = A~RSNUM AND R~WERKS = E~WERKS AND R~BAUGR = E~MATNR INNER JOIN MARA AS C1 ON R~MATNR = C1~MATNR WHERE A~FTRMI IN S_DATE AND A~AUFNR IN S_AUFNR AND C~MTART IN S_TYPE AND C~MATKL = 'T' AND R~BWART ='261' AND E~BWART = '101' AND R~XWAOK ='X' AND B~DWERK = '2000' AND R~XLOEK EQ SPACE AND E~KZBEW ='F' AND D~SPRAS = 'E' AND R~KZEAR = 'X' AND C~MATNR IN S_MATNR. This query gives repetative records from RESB.There must be some common field which i am not taking thats why its giving repetative records. If u find any solution pls lety me know ASAP. Thanks Swati Ghadge

2837


Why did you ever become involved in QA/testing?

1608


Is the IT field raise again? What is the position of IT after 4 years?

1686


What is easiest way to get the PL/i compiler,I didn't have found the compiler in my library. Is there any extra cost if we want to access the PL/1 programs?Actually we r having Mainframe rented training Ids

1618






In OB52 , How to define two open posting period, Like only 5 and 8 posting should be open.. should not open 6 and 7..period..

994


will it allow to add same value in HashMap class.

1664


Code for display the images from drive using vb 6.0?

4291


the systematic access of small computers in a distributed data processing system is referred as?

2726


How do you initialize a static member of a class with return value of some function?

671


could u please also write an example of a code that involves instances from an abstract class just as u did for interfaces because u said it could also work which i really doubt. thanks

1626


WHAT IS THE MEANING OF CONSTANT ...EXEEDS LENGTH LIMIT WHILE COPYING FROM PS FILE TO KSDS

1520


Explain what is OOPS and its concepts?

583


Write a program to find factorial of a number using functions

1252


It is possible to take number of controls added to form at run-time.ex-when user enter 6, 6 text boxes get added to form,next time number of controls get change as per user number enter. What is code for that?

1509