• No trigger needed!!

    Just use an INSERT command. The thing you need to take care of is that the value of "users_id" you enter in the [travel_request] table must allready exists in table [users]. The code below give you two possible solutions. The first will insert all values hard-coded. The second will insert the values and searches the "users_id" that belongs to the given "username".

    -- insert values hard-coded

    insert into travel_request values(1, 3, 200, 'me')

    -- insert values and search the "users_id" from the [users] table

    insert into travel_request

    select 2, users_id, 500, 'me'

    from users

    where username = 'Ram'

    select * from travel_request

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **