Writing to the database is the easy part, you do it with a sql
INSERT
statement :
SQL INSERT INTO Statement[
^]
The hard parts are :
1) What kind of database you are using, (sqlite, sql server, mysql, non relational ...) ?
2) What programming language you are using?
3) What is the temp sensor hardware?
4) How you connect to the sensor hardware?
5) Is the code going to run on the hardware or not?
...
All of which you have not specified, hence your question is not answerable.
Try asking the question from who ever told you to do the project.