Working on a dataset that contains weather information. It appears the dataset displays the UK temperature in Fahrenheit instead of Celsius, is there a function that would allow me to convert this information?
New to SQL looking for a solution to this data error.
CodePudding user response:
What do you mean by a function? do you want any provided from sql? As per my knowledge sql don't provide any functions to convert data to our specific requirement, we can do it using our own application implementations where we use the data from sql for example if you use java as your programming language
public List<Double> convertCelciusToFahrenheit(List<Double> dataCelcius){
List<Double> fahrenheit = dataCelcius.stream().map(celcius-> celcius*1.8
32).collect(Collectors.toList());
return fahrenheit;
}
CodePudding user response:
If you want to convert Fahrenheit to Celsius you should do the following steps:
Create a new "double" format field and name it whatever you want for example "Celsius".
Use this syntax to convert Fahrenheit to Celsius:
UPDATE table
SET C = (F -32) * 5.9
The C is the Celsius field and the F is the Fahrenheit field in your table.