# 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