how to write if case in select query in select statement

SELECT player_name,
       CASE WHEN year = 'FR' AND position = 'WR' THEN 'frosh_wr'
            ELSE NULL END AS sample_case_statement
  FROM benn.college_football_players

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
select case else select case if condition select if case acase sql select when case select case case with select statement in sql query which of the following is a case sql statement A CASE SQL statement is which of the following? how to use select statement in case statement in sql sql switch statement return value msssql using when case with and if else case in ms sql for value checking select case sql ms sql select case when sql case when or select case when with else use if in select statement sql where in case statement sql tsql switch case when null case statement with select statement example case in sql if else tsql how to apply condition in case query in sql using dropdown case AS in sql SQL IF STATMENT conditionals in sql queries case when sql case sql else sql case statement in where clause sql if condition and sql if else in where sql where if if in sql select build select based on case sql IF WITH SELECT in sql server sql if then sql select case use CASE WHEN in select sql case when sql with select case statement in and clause statement sql case statement in select statement sql sql view case statement SELECT CASE WHEN SELECT slq case usage how to case with in sql query SQL THEN after a case statement if use with case when then in sql server CASE statement includes when IN () sql t sql case example CASE statements in SQL are used in what clause(s)? sql case when with select query sql server case else case when t-sqò using case sql in clause with case sql and case select in case statement case when then case when clause sql server tsql case in select sql switch case in select case on mssql if case query case when then select sql case statement in select statement sql case construct case statement sq; or operator in case statement sql switch case in sql select case statement in sql select query select statement in case statement how to use select in case statement IN MS SQL case with or condition in sql server CASE statements in SQL are used in what clause(s) when statement in SQL case statement formulas sql select case inside select slq case inside select statement sql case statement select query in case statement when then select sql
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source