课程: SQL Server Fundamentals: Master Basic Query Techniques
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Case statements
- [Instructor] If this course were an album, I would call this last section, the bonus tracks. You could do a lot with just what we've gone over already but I want to give you a couple more tools to help you with data manipulation. There are times when you might want to present the data a little differently than it's available to you in your table, or you might want to show different texts depending on the data state. And that's where case statements can come in really handy. So on the screen here, we have a few things that we haven't covered yet. So first we've got this scalar variable, which we declare and then name with the @ symbol at the front. And then we told SQL server, what kind of data we're going to hold in this variable. And then this case we're using an int. And then we can assign a value to this variable using equals and we'll say five. So now, whenever we see at number in our code set, it will replace it with…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。