Unfortunately this is not as easy as it sounds - a simple SQL query is not going to do it. The one key rules are stored in a seperate table called MenuEntry that link to the primary call handler which, in turn, links to the subscriber account. The after greeting action is stored in the MessagingRule table which is associated with the primary call handler that's again associated with the subscriber.
Tricky business at best since their values (given these objects' different rolls in life) don't quite match up. It's doable but I wouldn't try it with an SQL query myself.
It sound very unusual to me that you'd want the after greeting action to map to a user input key action - the vast majority of the time the after greeting action is "take message". You're sure this is what you're trying to do? You don't mean "after message" action?
Regardless, the best I can suggest is to use the Audio Text Manager to set this - it's considerably faster than using the web based SA. You didn't indicate the version you're running but it shoudl come with a version of ATM in the Tools Depot on your desktop.