Search code examples
sqloracle-sqldeveloper

How To Find MA and Turn it into Massachusetts and put into column called state name


For my class, We have a table where States are listed as their abbreviations and I need to list the Full State name and abbreviation, but I'm unsure of how to get MA to Massachusets. I am unsure of what I would use to have it be transformed into what I need. Any help would be great thanks! It is all one table that contains ZIP, CITY, STATE.


Solution

  • You can try a case statement as follows (assuming you don't have a column that has the full version):

    SELECT CASE WHEN state = 'MA' THEN 'Massachusets' END AS state_name 
    FROM table_name