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

what is the difference between read the data from table and infotype

2065


can we use commit,rollback in triggers and how?

1510


Suppose server object is not loaded into the memory, and the client request for it , what will happen?

2177


write a query that returns one row for each department and the number of employees in that department. Given two tables EMPLOYEE and DEPARTMENT, where there can be multiple employees per department.

1184


What are two of your strengths that you will bring to our QA/testing team?

1654






1.what is the vesition managment.

1692


Write a program to swap the content of two variables without using a third variable.

583


1.Mutating table

1399


Write a program to reverse a number?

666


what is apt_dump_score in datastage where it is useful

1510


I HAVE DONE TESTING TOOLS COURSE,NOW I AM FRESHER,I AM NOT GETTING ANY CALLS,I WANT TO DO THE PROJECT ,WHERE I HAVE TO MEET TO DO THE PROJECT,I AM GOING WITH FAKE EXPERIENCE,SO WHAT I HAVE TO DO.

4310


8.In DSP,Define Signal and System?and various type of signals.

1568


what is the software to run the GSM gate opener program

1670


Write a program to show polymorphism.

703


what is the work of 1tier,2tier,&ntier? Plz Explain it!

2045