Question: How do I do then following. There are no spaces or dashes in the card\_number column

A column that displays the last four digits of the card\_number column in this format: XXXX-XXXX-XXXX-1234. In other words, use Xs for the first 12 digits of the card number and actual numbers for the last four digits of the number.

Answer: 
```
select 'XXXX-XXXX-XXXX-' + substring(card_number, 16) as masked_card_number
from your_table

```

[SQLFiddle demo](http://sqlfiddle.com/#!2/d41d8/21336)
------------------------------------------------------
With the help of substring and concat function you can do that

```
SELECT CONCAT('XXXX-XXXX-XXXX-', SUBSTRING(card_number, -4) AS masked_cc 
FROM table;

```