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;
More Related Contents:
- How do I list all the columns in a table?
- How to select the nth row in a SQL database table?
- In MySQL queries, why use join instead of where?
- ORA-00904: invalid identifier
- Is there any boolean type in Oracle databases?
- MySQL not using indexes with WHERE IN clause?
- Stored Procedure with optional “WHERE” parameters
- MySQL dump by query
- SQL ROWNUM how to return rows between a specific range
- SQLite – ORDER BY RAND()
- SQL – How to transpose?
- Which SQL query is better, MATCH AGAINST or LIKE?
- How to delete Duplicates in MySQL table
- SQL recursive query on self referencing table (Oracle)
- Does mysql have the equivalent of Oracle’s “analytic functions”?
- Oracle – How to create a materialized view with FAST REFRESH and JOINS
- Deferrable Constraints in SQL Server
- How to populate calendar table in Oracle?
- What is it exactly a BLOB in a DBMS context
- Create date from day, month, year fields in MySQL
- What can cause an Oracle ROWID to change?
- MySQL equivalent of Oracle’s SEQUENCE.NEXTVAL
- Find rows that have the same value on a column in MySQL
- Is there a version control system for database structure changes?
- what is the difference between GROUP BY and ORDER BY in sql
- How do NULL values affect performance in a database search?
- What’s the correct name for an “association table” (a many-to-many relationship) [closed]
- Query a Table’s Foreign Key relationships
- How to find all IDs of children recursively?
- ORA-01652: unable to extend temp segment by 128 in tablespace SYSTEM: How to extend?