I have two tables in my MySQL database, which were created like this:
CREATE TABLE table1 (
id int auto_increment,
first name varchar(10),
primary key(id)
)
CREATE TABLE table2 (
id_fk int,
last varchar(30),
CONSTRAINT fkid FOREIGN KEY(idfk) REFERENCES table1(id) ON DELETE CASCADE
)
The point is that table2 has a foreign key referencing the primary key in table1
when im inserting in table1 it is ok
ex:1. ravi
I would like to add entries to both of the tables within one transaction
how it is passible please explain with code
thank u
Related Tutorials/Questions & Answers:
how to use foreign key in javahow to
use foreign key in java I have two tables in my MySQL... varchar(30),
CONSTRAINT fkid
FOREIGN KEY(idfk) REFERENCES table1(id) ON DELETE CASCADE
)
The point is that table2 has a
foreign key referencing the primary
key Advertisements
Foreign key update tableForeign key update table
How to update table that has the
foreign key in SQL..?
ALTER TABLE YourTable
ADD CONSTRAINT FK_YourForeignKey
FOREIGN KEY (YourForeignKeyColumn)
REFERENCES YourPrimaryTable
Mysql Alter Foreign Key Mysql Alter
Foreign Key
A
Foreign Key is a field that marks to the primary
key of another
table. The
use of the
foreign key is used to ensure referential
foreign key error in sql on
foreign key
can any one tell me plz
how to reference matchdetails...
foreign key error in sql create table matchdetails(mid varchar2(10... varchar2(10),sixes varchar2(10),primary
key(mid.pid),
foreign key(mid
Foreign key in mysqlForeign key in mysql Hi I am creating a website and linking..., there are
foreign keys in some of the tables - does anyone know
how to link the
foreign key of one table into another table within phpmyadmin so the database
hibernate Foreign key using set methods in orders table in feild P_Id which is
foreign key.
How to insert...),
KEY P_Id (P_Id),
CONSTRAINT orders_ibfk_1
FOREIGN KEY (P_Id) REFERENCES...hibernate
Foreign key sir,
I am using hibernate in netbeans.
I have
crud operations with foreign key constraint.crud operations with
foreign key constraint. I neeed to know
how to perform crud operations in mysql with
foreign key constraint using mvc architecture i.e using servlet jsp and bean.
please provide all the code so that i can
alter table add foreign key mysqlalter table add
foreign key mysql Hi,
How to add
foreign key in mysql using the query 'alter table add
foreign key mysql'
Thanks
Hi,
We can
use the following query:
ALTER TABLE emp_address
ADD
FOREIGN KEY (emp_id
How to add key value pair in JavaHow to add
key value pair in Java Hi,
I have to store the
key and value pair in
Java.
How to store
key value pair in
Java?
Thanks
Hi,
You can
use the put method of Hashtable.
Check the tutorial Creating a Hash
How to design key, design key, key
How to design
key
...
overlay". Draw a circle and set it top of the
key then
use
"Gradient... the big circle as here.
Now you have completed design of the
key,
use java key value pairjava key value pair Hi,
How to save the
java key value pair in
Java?
Thanks
Hi,
You can
use the Hashtable for this purpose.
Check the tutorial Creating a Hash Table.
Thanks