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

how to add a new table with variables and thier values into a imported file uisng proc import?

0 Answers  


how pseudo column works?

0 Answers   Oracle,


HOW TO FIND NUMBER OF TWOS IN N!(N FACTORIAL)??

0 Answers  


What is the difference between WebIntelligence and Designer in creating universes?

0 Answers  


why we use static with only main()class not with other class

2 Answers   TCS,






how to generate dsnless connectivity in j2ee

0 Answers  


Write a program to find whether a given number is prime or not.

0 Answers   Syntel, Visa,


How to swap two String values without using a third variable?

8 Answers   Infosys,


Write a shell program to test whether a given year is leap year or not ?

0 Answers   Patni,


Data structure used to impliment a menu:

0 Answers   Verifone,


What are the five tracing levels in System.Diagnostics.TraceSwitcher?

1 Answers  


how many logical drive we can form to physical device in our computer?

1 Answers   nvidia,


Categories