# I've put an introductory Prolog tut for SQL programmers on Swish

**URL:** <https://swi-prolog.discourse.group/t/ive-put-an-introductory-prolog-tut-for-sql-programmers-on-swish/3636>\
**Category:** Nice to know\
**Created:** [February 22, 2021, 12:31pm UTC](https://swi-prolog.discourse.group/t/ive-put-an-introductory-prolog-tut-for-sql-programmers-on-swish/3636 "2021-02-22T12:31:22Z")\
**Posts on this page:** 1\
**Showing post:** 44

<div class="post-metadata">

**Author:** ![peter.ludemann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/peter.ludemann/32/48_2.png) [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Post date:** [February 24, 2021, 5:33pm UTC](https://swi-prolog.discourse.group/t/ive-put-an-introductory-prolog-tut-for-sql-programmers-on-swish/3636/44 "2021-02-24T17:33:11Z")

</div>

I think the correct solution for `null` (which has its own problems in SQL – see [Errors considered harmful - #102 by peter.ludemann](https://swi-prolog.discourse.group/t/errors-considered-harmful/3574/102)) is to do something like Haskell’s `Maybe = Just a | Nothing` … that is, a non-defaulty representation. (In Prolog, this would be `just(X)` and `nothing`, for example, which can always be distinguished.)  
Although, when designing a database, it’s often possible to avoid `null` completely – with specifying `not null` for a column when creating a table in SQL, and specifying a suitable default value for strings (typically a zero-length string).

---

_[View the full topic](https://swi-prolog.discourse.group/t/ive-put-an-introductory-prolog-tut-for-sql-programmers-on-swish/3636)._
