Formatting the SQL-like script

I would leave it to listings package which understands SQL among many many other languages.

\documentclass{article}
\usepackage{xcolor,listings}
\usepackage{textcomp}
\lstset{upquote=true}

\begin{document}
Here is an example 
\begin{lstlisting}[
           language=SQL,
           showspaces=false,
           basicstyle=\ttfamily,
           numbers=left,
           numberstyle=\tiny,
           commentstyle=\color{gray}
        ]
a = LOAD 'data' USING BinStorage AS (user);
b = GROUP a BY user;
/* Now we are ready to loop */
c = FOREACH b GENERATE COUNT(a) AS cnt;
d = ORDER c BY cnt;
\end{lstlisting}

\end{document}

enter image description here


I believe that a simple verbatim environment will suffice.

\documentclass{article}

\begin{document}
\begin{verbatim}
a = LOAD `data' USING BinStorage AS (user);
b = GROUP a BY user;
c = FOREACH b GENERATE COUNT(a) AS cnt;
d = ORDER c BY cnt;
\end{verbatim}
\end{document}

Output:

enter image description here

Notice that we have to use the left single quote ` and right single quote ' characters marks to get the right quotation marks.


Two easy ways:

\documentclass{article}
\begin{document}

For example:

{\obeylines\obeyspaces
\texttt{
a = LOAD 'data' USING BinStorage AS (user);
b = GROUP a BY user;
c = FOREACH b GENERATE COUNT(a) AS cnt;
d = ORDER c BY cnt;
}}

\medskip
Or:

\begin{verbatim}
a = LOAD 'data' USING BinStorage AS (user);
b = GROUP a BY user;
c = FOREACH b GENERATE COUNT(a) AS cnt;
d = ORDER c BY cnt;
\end{verbatim}


\end{document}

enter image description here