From the course: Querying Microsoft SQL Server 2022
Unlock the full course today
Join today to access over 24,200 courses taught by industry experts.
Create values with constants and math - SQL Server Tutorial
From the course: Querying Microsoft SQL Server 2022
Create values with constants and math
- Sometimes it's beneficial to return a column of values in your results that don't actually exist in the original table. For instance, if you're building a report and you need each record to be associated with the same company or the same tax rate to show alongside each order. Let's explore some data from a different table now. Let me go ahead and minimize the human resources dot department table and I'll scroll down to the production schema. We'll find a table called production dot product. There's a lot of different columns in here but we're only going to pull out a few of 'em. I'll write a simple query that returns a couple of these columns. We'll start by pressing the new query button. Then I'll type in select, name, comma, and online number two, the second column, product number. I don't need a column after this one because it's going to be the last column that we're typing up. So I'll come down to line number three.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
What is Transact SQL?3m 22s
-
(Locked)
The SQL querying environment8m 6s
-
(Locked)
Return records with SELECT and FROM8m 45s
-
(Locked)
Filter records with WHERE4m 42s
-
(Locked)
Sort records with ORDER BY2m 57s
-
(Locked)
Column aliases2m 24s
-
(Locked)
Create values with constants and math4m 22s
-
(Locked)
Challenge: Write a SELECT query1m 15s
-
(Locked)
Solution: Write a SELECT query4m 14s
-
(Locked)
Solution: Query information from a database5m 32s
-
-
-
-
-
-
-
-
-
-