
how to create a table using java language with primary key and foreign key

Hi Friend,
A foreign key is a field (or fields) that points to the primary key of another table.
CREATE TABLE CUSTOMER (SID integer, FirstName varchar(40), LastName varchar(40), Primary Key (SID )); CREATE TABLE ORDERS (Order_ID integer, Order_Date date, Customer_SID integer, Amount double, Primary Key (Order_ID), Foreign Key (Customer_SID) references CUSTOMER(SID));
Thanks

For more information, visit the following link:
http://www.roseindia.net/sql/mysql-alter/mysql-alter-foreign-key.shtml
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.