I have 2 tables: student and studentmarks. I want to insert first in student and then insert in studentmarks in Talend. How can I achieve this task?
Related
I have 2 tables. First table is called Person. Second table is called PersonRule. Person table has much columns. But PersonRule has just 2 columns. In the person table, there is a column called ruleid. The column at the same time, there is in the PersonRule table. Is it possible, when i insert to data Person table, i want to automatically create a record in PersonRule table without trigger.?
And in PostgreSQL how can i do this.?
I have 4 Tables
Customer(cust_id (PK), cust_phone, name)
Order((order_id,cust_id) (PK), order_date, order_amt)
Order_line((order_id,Product_id)(PK), qty)
Product(product_id, Product_name, product_price)
The order table has a composite key saying an order only exists with a customer.
The Order_line table has a composite key as it is a bridge table between product and order table. the order_amt is a calculated column, its the total order value.
The question is how do i insert data into the order table and the Order_line table? using procedure, triggers or a temp table or any other way? I am really stuck at this. Help!!
Do I need to make any changes in the model?
I have two tables, e.g. TABLE1, TABLE2. They are joined by "one-to-many" relationship (many records from TABLE2 are referencing to every record in TABLE1). I want to make a trigger that runs just after adding a new row in TABLE1 and all the rows related with it in TABLE2. How to solve it? In particular, how to "inform" the trigger that all related rows from TABLE2 are added?
Is there anyway we can compare two different tables based on any specific column using Spring Batch.
For example:
Table 1 Content:
cust_id, cust_name,flag
Table 2 Content:
cust_id, cust_name,flag
My requirement is like this,
whenever a record is available in Table 1, I will insert the same into Table 2,
when record is deleted in Table 1,I will mark the flag in Table 2 as 'N'
Why do you need spring batch here, creating a over-head of DB IO read/write. Create Trigger in DB such that when insert/delete is performed a trigger is generated and you will perform suitable task
Is there a way to populate a table dynamically from another table?
That is I have 2 table
Customer which has field regionName
Region which has field Name.
On populating customer table,it should populate the distinct values of customer table regionName into the Region table Name field automatically.
Is it possible? Then how?If not How to populate the value in both table from a single webservices?
That depends on what you mean with "populating".
If you want to do this only once, use a statement like this:
INSERT INTO Region(Name) SELECT DISTINCT regionName FROM customer;
If you want to do this whenever a new customer is added, you need a trigger:
CREATE TRIGGER add_customer_region
AFTER INSERT ON customer
FOR EACH ROW
BEGIN
INSERT OR IGNORE INTO Region(Name) VALUES(NEW.regionName);
END;
This trigger requires a UNIQUE constraint on the Region.Name column.