Original post

This shows how we can use the -sql-driver (which uses the database/sql interface) to form a connection to our database server using the Open method.
Once we have our connection, we can create a statement of our SQL query, and to prevent SQL injection we send the parameters (values which should correspond with to the question marks in our query) separately along with the Exec method. Finally, calling the LastInsertId() we can get the id of the row we’ve just inserted – and in our example, we output this value to screen.