I\'m using Delphi 7 and can\'t predict the target version of Windows.
I need to create a database (probably MySql, but might be something else) and define some table
Here is an article that explains it detail
Capture the output from a DOS (command/console) Window
But in short you need to Create two pipes to read and write the output. Then you need to set StdInput and StdOutput in the TStartUpInfo structure, then pass this structure to the CreateProcess() call.
Here is another article that shows how to Wait for the process to finish.