In the previous article we’ve seen how we can be able to project or display all these columns from a table as well as how we can be able to display only the top end rolls from a table in this movie you will see how we can be able to change a column hitting inside a select statement and how we can be able to perform some mathematical operation using columns is a select state.
I will also give you some overview of what mathematical operations or functions looks like inside a select statement. In this example some experts predicted that a population of every country in the world will be increasing by a million people in the next five years. And you are asked to call it final. Population value. Thirty five years. In this case what you can do is you can use a select statement a name of a country and our population size plus one million from country.
If you execute the sequence statement without using a column heading you’ll get a name like Australia Afghanistan and other countries. But for the newly created you not have any money in order to give it a column heading for I knew would call quited Cole and you can do as an economy now if execute the sequence statement. It’s going to give me a name of a country as well as the projected population besides using some simple mathematical operation like this.
Once the calls are also has some pre-built functions like this for example. In this case we want to calculate the total area in a row of every lake in the world that we can execute this one. This is going to be our total area in an average area of every link in the world. SQL Server also follows a mathematical rule or Mars or Rockett older division multiplication by addition and subtraction.
Like for example in this case we have two plus three times for the result. Could it be two plus 3 which is 5 5 times 4 which is 20. But because of bored us sequel server won’t finish multiplication ahead of time then it’s going to be three times four. Which is 12 plus 2. It is 14. So if we execute this month then we’ll get 14. But if we want to change how this operation works and we want to add two and three fourths then multiply it by 4.
We can use a bracket since the bracket comes first. The important rule then this will be calculated ahead of time. Then the result will be multiplied by four. Two plus three will be five lifetimes or is going to be 22. Now if I execute this statement I’ll get twenty.