current position:Home>Hive -- about case when
Hive -- about case when
2022-02-04 16:58:53 【CSDN Q & A】
Pictured
case when I always thought that only this form is commonly used
#1-----------------------------------
SELECT epc.id,case when epc.epc_type='1' then '1 Emergency price change of fresh food ' when epc.epc_type='2' then '2 Poster error correction ' end as epc_type,epc.form_flag,epc.convenience_flag,lst.cmmdty_code gds_cd,lst.cmmdty_name,
** Today I see another form **
#2-----------------------------------
SELECT epc.id,case when epc.epc_type='1' then '1 Emergency price change of fresh food ' elsecase when epc.epc_type='2' then '2 Poster error correction ' end end epc_type,epc.form_flag,epc.convenience_flag,lst.cmmdty_code gds_cd,lst.cmmdty_name,
There are a few questions
1、 Is the result of these two ways of writing the same , What's the difference ??
2、 When will I use the second way
3、 Every case when Statements in end You need to write an alias after , that #2 Because there are 2 individual case, So there is 2 individual end, But only one alias was written ..
case when
Take the answer :
This is a case when then Nesting of , the second case Written in the first case Of else It's just inside
Follow if set if Same, same
copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/02/202202041658512526.html
The sidebar is recommended
- What are the instructions for configuring the processing mode of the target existing tables that DTS self built MySQL synchronizes to RDS MySQL?
- What is the core program running mechanism of MapReduce?
- What is the core competence of Alibaba cloud log service?
- What are the types of MySQL indexes?
- What is the description of the configuration of synchronization objects from DTS self built Mysql to RDS MySQL?
- What is the function of clusteringkey?
- What should I pay attention to when starting and using ECS?
- What is the description of the configuration of the mapping name change of DTS self built MySQL synchronized to RDS MySQL?
- What are the principles for creating indexes in MySQL?
- What is the description of the configuration of filtering data to be synchronized from DTS self built Mysql to RDS MySQL?
guess what you like
-
What is the basic logic of MapReduce client for map phase parallelism planning?
-
What is the description of the configuration of SQL operations for DTS self built MySQL synchronization to RDS MySQL synchronization?
-
What is the leftmost and most prefixed principle of MySQL?
-
What is the description of setting alarm configuration for DTS self built MySQL synchronization to RDS MySQL?
-
What does MySQL overlay index and back table refer to?
-
What are the instructions for configuring the case policy of the object name of the target database synchronized from DTS self built Mysql to RDS MySQL?
-
How to pull data from maxcompute and upload results?
-
How to use serverless log to realize alarm?
-
What is optimizing bitmap indexing?
-
Source table DMS_ ONLINE_ What is the description of whether to copy the temporary table to the target library during DDL?
Random recommended
- Will MySQL's non clustered indexes be queried back to the table?
- How to schedule periodically in maxcompute?
- What are the instructions for configuring the retry time after DTS self built MySQL is synchronized to RDS MySQL's source database and target database cannot be connected?
- Why should MySQL pay attention to the order in the composite index?
- What is an object storage OSS?
- What are the characteristics of the seamless connection between cloud storage and maxcomputesql?
- What is the definition of MySQL database transaction?
- What are the steps of hologres real-time writing and point query?
- What is machine learning Pai?
- What source databases are supported for synchronization between RDS and MySQL instances?
- What target databases are supported for synchronization between RDS and MySQL instances?
- What are the prerequisites for supporting synchronization between RDS and MySQL instances?
- What are the three implications of MapReduce?
- What are the data formats supported by maxcomputesql
- What is hologres' view of the execution plan?
- What are the source database restrictions for synchronization between RDS and MySQL instances?
- What is the difference between physical server and cloud server?
- What are other restrictions on synchronization between RDS and MySQL instances?
- What is the origin of MapReduce?
- What is a physical server?
- What is the description of the special case of synchronization between RDS and MySQL instances?
- What is the synchronization architecture supported for synchronization between RDS and MySQL instances?
- How does MySQL store Emoji expressions in the database
- How can MySQL select statements only take the first data? How to get the sum of a column of different individuals? 【LIMIT/GROUP BY】
- JavaScript wechat applet solves the problem at the front end. The front end receives data of date time type one day less than that in the database
- What book do you read about C introduction?
- Ask questions about the use of switch in JS.
- JSP suddenly does not recognize java code?
- Use the temporary URL for authorized access. After obtaining the URL, how to send a post request to initialize the segmented upload task
- How to write the code about the oscillation phenomenon of interpolation polynomial in MATLAB?
- About SQL, I can't write it out!
- Please tell me how to write it
- I want to download this 24212 version, but the default download found on the official website is 14.0.23026. Where can I download this
- In C language, how to initialize a string in the structure array (that is, assign a value to a string or make a string empty)
- Push box, why can s move normally when the first character (W, a, s, d) is input, and then only the input characters are displayed (the character array is copied and deformed)
- What went wrong? It can't run
- Matlab about signal input and triangular wave square wave
- Ask for help. How can I get the project column back
- Pictures are stored in OSS with window When open, the same origin policy will appear,
- Ask how to do this problem. Zero basis won't
- Pdf exported by kendoui cannot be recognized & lt; th> What about bold fonts?