i will answer some of your questions:
(1) the following will explicitly turn off your machine
(2) you really should make a user account and just issue "su" whenever you need to do some administrative jobs. reason: in case you make something stupid, you won't ruin your system.
(3) sure you can interact with databases using c. but it would be better if you're just using one of those scripting languages like ruby.