<p>Can source code examples be kept in a SQL database <strong>while retaining all formatting</strong> (tabs, newlines, etc.)? If so what data type would be used?</p>

Yes, use a
```
TEXT
```
type (or
```
MEDIUMTEXT
```
or
```
LONGTEXT
```
- you get the idea)