# How do I do table alignment?

I have the following code:

\section{Database Design}

\begin{center}
\begin{table}
\begin{tabular}{ | l |  l |}
\hline
Field & Type \\ \hline
id & Primary key \\ \hline
firstName & String \\ \hline
lastName & String \\ \hline
email & String \\ \hline
\end{tabular}
\caption{User}
\end{table}
\end{center}


There are a few alignment problems:

1. The table seems to be floating top left above my section
2. My caption is centered and out of line with the table

How can I center my table and have it placed below my 'Database Design' section?

-

You should use \centering inside table environment to center the table. Also the placement options [htbp] can be used to influence the placement of the table. An exclamation ! like [!h] will force latex to place here.

\documentclass{article}
\begin{document}
\section{Database Design}
%
\begin{table}[!h] %%,---- note the placement option
\centering    %%,------command here for centering
\begin{tabular}{ | l |  l |}
\hline
Field & Type \\ \hline
id & Primary key \\ \hline
firstName & String \\ \hline
lastName & String \\ \hline
email & String \\ \hline

Also avoid using \begin{center}.....\end{center} as it will add extra vertical space (that may be unwanted in some cases like this). Instead use \centering.
For a more stricter placement pl. consult float package that provides an option H means definitely here (as opposed to h meaning here if possible). For more details consult the documentation of float (texdoc float) page no. 4.