you can use any angularjs code with ionic.
the ionic framework is something like an extension for angular (directives, services, ...).
If you want to mean local sql --> look for "cordova sqlite".
The ngCordova Toolkit has a wrapper for that:
http://ngcordova.com/docs/plugins/sqlite/
If you want to connect a backend, which is connected to a database --> use angularjs $http-service or the $resource-service if you want a rest-api wrapper.
There is a GUI to create ionic-apps/layouts
https://creator.ionic.io/
But it is only free for one public code-source/app.