Accessing common database for mobile app and website

I am new to ionic, java script and all these stuffs.My work is to develop an hybrid mobile app for the website already existing.For the UI design i am using ionic frame work.
My doubt is that how can i access the same sql database used for the website existing already?
what programming language should i use for the database access at the server side? whether I should go for nodejs or can i do the same with angularjs itself?
where should i use the API for db access?
whether can i achieve it with put using API?

please refer me some materials to get clear idea.

first there are two parts:

Frontend and Backend

In your case you need and API written in the script/programming language you want (nodejs, php, python, perl, java, …) as your backend.
But this should depend where your website gets the data from.

If there is a backend for your website or your website is written in php --> create a little php-api for your app.
If you have thousands of parallel users in your app you will reach the limits of simple php, perl, python apps really fast (without looking for loadbalancing and…).
And if you have an own server instead of a simple small webspace you can give nodejs a try :smile:

So the communication would be the following in general:

APP --> sends requests with angularjs $http-service or $resource --> API written in the language of your choice is connected to your database and receives requests --> gets data and processes data --> sends data to you app.

The interesting part is the getting and processing part of your requests.
There you should look what request-method you have like GET, PUT, POST, DELETE. and then you should send information within the request what you want to do with what.

like a example request:
GET http://xxx.xx/api/users
–> get all users of the db
GET http://xxx.xx/api/users/id/1234
–> get the user with the id 1234
DELETE http://xxx.xx/api/users/1234
–> delete user with id 1234

if you have a simple index.php file your urls can look like this:
GET http://xxx.xx/index.php?class=users&

so you can first decide what method the request has --> okay get… next step --> what class, data it belongs to --> oh there is the query paramerter “class” --> oh and the value “users” --> okay get all users
or this one:
GET http://xxx.xx/index.php?class=users&id=1234

get the user with id 1234.

Sometimes you need a special action because you have multiple get actions on the same data like users can have ratings and you want the ratings of a special user:
GET http://xxx.xx/index.php?class=users&id=1234&action=ratings

So the important point of an api is an unified url-scheme.

Thanks for the clear explanation bengtler.Actually the website is built in nodejs as a scripting language so i have to generate API using nodejs and use it with angularjs.Awesome.
I have another doubt how could i built app for windows phone using ionic?
Is it possible only by using visual studio and ionic all together?
Once if i develop the app to run in android can i use the same to build windows phone app?

windows phone used .wap xtension build file you can create your project from phonegap and generate wap file

Is it possible to do the same with ionic and cordova? instead of using phonegap?
if yes, then how can i do that?