Oracle sql updating multiple tables

These exercises allow you to try out your skills with the UPDATE statement.

You will be given questions that you need to solve.

A couple of examples of when I do this is that I built a dynamic contest framework for my company, and also a Commission Calculator for recalculation of commission.

oracle sql updating multiple tables-53oracle sql updating multiple tables-53

In addition, we would want to see their zipcode, and their country code.

Let’s create a table: UPDATE customer_order_total cot SET cot.postal_code = ( SELECT c.cust_address.postal_code FROM oe.customers c WHERE c.customer_id = cot.customer_id ), cot.country_code = ( SELECT c.cust_address.country_id FROM oe.customers c WHERE c.customer_id = cot.customer_id ) ; UPDATE customer_order_total cot SET ( cot.postal_code, cot.country_code ) = ( SELECT c.cust_address.postal_code, c.cust_address.country_id FROM oe.customers c WHERE c.customer_id = cot.customer_id ) ; In the update statement above, you need to make sure that you specify the (in this case) the unique identifier in the customer table that matches the customer id in our customer_order_total table.

But, you might have to have your DBA activate the schemas, and give you access.

Let us start simple, and pretend that the department with id # 20, “Marketing” is from now on going to be named “Customer Relations”.

But, the syntax example above might not show the whole truth, since we can have a situation like this: In the expanded version of our UPDATE syntax above, the value that we want to update column1 with, actually comes from a different table.

BUT, in this post I really wanted to show you how to update multiple columns in a table at once.

But, at the same time they were going to be under management of manager id # 205.

Here is a simple update: And, of course remember to commit.

You can also perform more complicated updates in Oracle.

Tags: , ,