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



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

Answer / 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

More Programming Languages AllOther Interview Questions

Building Quotation engine program

5 Answers   Wipro,


I m new to the dbms. Recently i came across words clustered indexes & nonclustered indexes but i dont know what is this all about & whats the difference between them.. So please help me!!!!!!!!

0 Answers  


Diff between IF and where ?

0 Answers   Accenture,


What is the Super Class of Exception in java?

11 Answers   Andesa Services, Benchmark, CitiGroup, CMC, Evergent, KOT Systems, Value Labs, Vijay infoart Solutions,


What is procedural oriented language language..? give some examples of this language....?

0 Answers  


what is fisrt female program

1 Answers  


5. Which of the following can you do with DB2 Express- C? Query databases with SQL Query databases with XML using XQuery and XPath Use SQL in Xquery and Xquery in SQL All of the above

0 Answers  


Diffrence between 2.0,3.0,3.5,4.0. versions of .net?

0 Answers  


sample and simple coding where we get?

0 Answers   IBM,


it is a language or tools?

0 Answers  


what is c sharp dotnet

0 Answers   NIC,


what are other resources are needed for this mantis?

0 Answers  


Categories