There are two basic ways of formulating and querying databases in Prolog:
The second technique is usually more convenient. A simple file for the `mustard' example is:
condiment(mustard).
spice(X) :- condiment(X).
:- spice(X),write(X),nl,halt.
The `wh'-type query is prefixed by the operator `:-', and the variable is written to standard output (usually the monitor) by the `write' predicate, followed by another writing predicate, `nl', which starts a new line.