Not sure you can do this prior to login ... once logged on, however, then the users preference for a theme IF allowed to change themes is set at the user level.
Search your admin menu for "theme" and you should find the options for themes.
Direct manipulation of DB is never considered a solution ... or so I've read.
I can think of a couple of potential issues ...
1. once one sets up accounts via editing DB to a theme, what prevents them from changing the theme? It's a user preference. Guess you could hack the dashboard or whatever screen a student would see via css and hide the field for theme preference. Once one starts down that road (hacking code) it could make your next update/upgrade more 'complicated'.
2. certain themes have special process should an update be needed. While you as the admin user can accomplish those students cannot. This to say, if a students theme goes wonky it might make support more complicated for you.
Others might know a way that's flawless ... otherwise, my 2 cent advice ... it's your Moodle! ;)
'spirit of sharing', Ken