Added sql file

Start copying functions over to the SQL extension file.