krish wrote:
Can anybody tell me how SQL query can be done using C
Usually, it is done by one of the following methods:
1. A database specific API call
2. A standards based API call (such as ODBC, OLEDB, etc.)
3. Embedded SQL.
How to accomplish #1 will depend on your database. Often, you will
have more than one choice, even here. For instance, with PostgreSQL,
you might use LIBPQ:
http://www.postgresql.org/files/docu...l/node147.html
How to accomplish #2 will depend on what methods and drivers you
choose.
With PostgreSQL, you might use:
http://pgfoundry.org/projects/psqlodbc/
for ODBC (among many ODBC driver possibilities)
or you might use:
http://pgfoundry.org/projects/oledb/
among many OLEDB possibilities,
etc.
How to accomplish #3 will depend on what sort of support your database
vendor offers.
For instance, ECPG is the PostgreSQL embedded SQL processor.
Note that none of this has anything to do with the C language, per se.
Probably, a group that targets your exact database system is more
appropriate. If you want to generically attach to arbitrary database
systems, then you definitely want to use a standards based approach
like ODBC or OLEDB.