From the course: Learning Microsoft SQL Server 2019

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Use functions to calculate values

Use functions to calculate values - SQL Server Tutorial

From the course: Learning Microsoft SQL Server 2019

Start my 1-month free trial

Use functions to calculate values

- [Instructor] Besides pulling information out of our database in an organized fashion, queries will also help us view a bigger picture what's going on within the organization. We can use queries to combine values together in new ways to give us more insight than what the raw data can reveal alone. Let's take a look at this by going into the WideWorldImporters tables once again and I'm going to find the table called Sales.OrderLines. I'll right-click on it and choose Select Top 1,000 Rows. In the Results, we can see that each order line includes information about the quantity of products ordered, the units price for each product and the tax rate they have applied to that product. Using these three values, we can calculate a total amount due for each order line. To do this, we'll start a new query. Then, we'll use the Select statement to pull out information from the OrderLineID column, the Quantity column, the UnitPrice and the TaxRate columns. I'll come down to the next line and type…

Contents