You can use IF()
where in Oracle you would have used DECODE()
.
mysql> select if(emp_id=1,'X','Y') as test, emp_id from emps;
Related Posts:
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- ORA-00904: invalid identifier
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- Case statement in MySQL
- Error Code: 2013. Lost connection to MySQL server during query
- how to drop partition without dropping data in MySQL?
- What is it exactly a BLOB in a DBMS context
- How do I reset a sequence in Oracle?
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- What is the difference between “INNER JOIN” and “OUTER JOIN”?
- What is the difference between “INNER JOIN” and “OUTER JOIN”?
- Unknown column in ‘field list’ error on MySQL Update query
- Unknown column in ‘field list’ error on MySQL Update query
- Self Join to get employee manager name
- how to fix oracle ORA-01722 invalid number error
- MySQL – Operand should contain 1 column(s)
- MySQL “CREATE TABLE IF NOT EXISTS” -> Error 1050
- MySQL create table if not exists and insert record only if table was created
- ORA-00979 not a group by expression
- ORA-00907: missing right parenthesis
- How do I use properly CASE..WHEN in MySQL
- Why do we need “Relationships” between tables at all?
- How can I do a FULL OUTER JOIN in MySQL?
- MySQL query String contains
- What’s the difference between VARCHAR and CHAR?
- How to declare a variable in MySQL?
- How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?
- ORA-01843 not a valid month- Comparing Dates
- MySQL Cannot Add Foreign Key Constraint
- How do I restore a dump file from mysqldump?
- ORA-00918: column ambiguously defined in SELECT *
- Oracle error : ORA-00905: Missing keyword
- How to split the name string in mysql?
- What does SQL Select symbol || mean?
- How do I import an SQL file using the command line in MySQL?
- Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
- mysql Foreign key constraint is incorrectly formed error
- How do I limit the number of rows returned by an Oracle query after ordering?
- Oracle SELECT TOP 10 records
- MySQL: Invalid use of group function
- Can a foreign key be NULL and/or duplicate?
- How to Select Top 100 rows in Oracle?
- How can I return pivot table output in MySQL?
- ORA-12560: TNS:protocol adaptor error
- Compare dates in MySQL
- MySQL “WITH” clause
- What is the difference between JOIN and UNION?
- MySQL Multiple Joins in one query?
- MySQL syntax for Join Update
- ORA-00972 identifier is too long alias column name
- Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
- Oracle Apex column link from LOV values
- PLS-00103: Encountered the symbol when expecting one of the following:
- What’s the difference between RANK() and DENSE_RANK() functions in oracle?
- ORA-00918: column ambiguously defined in SELECT *
- ORA-00918: column ambiguously defined in SELECT *
- 1052: Column ‘id’ in field list is ambiguous
- 1052: Column ‘id’ in field list is ambiguous
- difference between primary key and unique key
- Oracle – ORA-01489: result of string concatenation is too long [duplicate]
- MySQL combine two columns into one column
- ORA-01861: literal does not match format string
- Simple way to calculate median with MySQL
- Creating a search form in PHP to search a database?
- The ALTER TABLE statement conflicted with the FOREIGN KEY constraint
- Error 1046 No database Selected, how to resolve?
- “ORA-01438: value larger than specified precision allowed for this column” when inserting 3
- MySQL Error 1264: out of range value for column
- How do you create a temporary table in an Oracle database?
- Oracle “Partition By” Keyword
- How to insert date values into table
- Oracle SQL: Update a table with data from another table
- Oracle SQL query for Date format
- Remove duplicate rows in MySQL
- How to SUM and SUBTRACT using SQL?
- The backend version is not supported to design database diagrams or tables
- Create mysql table directly from CSV file using the CSV Storage engine?
- Simulate CREATE DATABASE IF NOT EXISTS for PostgreSQL?
- Cast from VARCHAR to INT – MySQL
- SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax — PHP — PDO [duplicate]
- SQL selecting rows by most recent date with two unique columns
- How do you force mysql LIKE to be case sensitive?
- ORA-06502: PL/SQL: numeric or value error: character string buffer too small
- MySQL – UPDATE multiple rows with different values in one query
- Postgres Error: More than one row returned by a subquery used as an expression
- How to create a MySQL hierarchical recursive query?
- ERROR 1148: The used command is not allowed with this MySQL version
- Insert into a MySQL table or update if exists
- How to round down to nearest integer in MySQL?
- Comparing Dates in Oracle SQL
- Convert timestamp to date in Oracle SQL
- MySQL starts with searching issue
- Query to convert from datetime to date mysql
- Is it possible to GROUP BY multiple columns using MySQL?
- MySQL error: key specification without a key length
- Update statement with inner join on Oracle
- Best way to test if a row exists in a MySQL table
- Check if MySQL table exists without using “select from” syntax?
- mysql update column with value from another table
- The used SELECT statements have a different number of columns