dhaval thakor wrote:so my question is how do add value of userid to QUERYINFO table when newly user info is added to USERINFO...?
Any parent-child relationship implemented by a foreign key basically means the parent must exist before the child can be created, which isn't too hard to figure out - your parents existed before you did, right?
1. Write the user record.
2. Get the ID of the new user. The mechanism for doing this will depend on your set-up e.g. some databases such as Oracle support a RETURNING clause on DML, or your ORM might give you a way to do this.
3. Include the new user ID in your new Query record.
4. Write the Query record.
You could do steps 2 to 4 in a single SQL statement, but as you're posting on a Java forum, I'm guessing you want to use Java.