One of the most exciting announcements with the latest drop from the product teams this month would have to be "Execute SQL" from O365 no less..
http://help.nintex.com/en-US/O365/Default.htm#O365WorkFlow/Workflow%20Actions/Execute%20SQL.htm
YES, this means you can execute SQL from the SharePoint Online platform to your internally hosted SQL servers. This does have some caveats though. Note: The database must be internet-accessible.
For this post I'm going to connect to my Azure SQL server..
Ok so first of all get your DB setup with some tables.. I used this to get me started. Getting started with SQL Database - Azure
I was then able to use SQL Server Management Studio to connect to the server and check out the tables etc..
Heading into Nintex Workflow for O365, and adding the "Execute SQL" action to the canvas we can get into configuring it.. Now if you are familiar with the "Execute SQL" action with the Nintex Workflow for SharePoint (2007, 2010, 2013) this is pretty much the same to configure.
What I have done with this test workflow, is setup a custom list and used to state the query I wish to execute. The workflow then goes off and execute my query against the Azure SQL Database specified in my connection string and returns the results.. See below for a short video displaying the magic in real time..
For help with connection strings I highly recommend http://www.connectionstrings.com