21/27
\begin{frame}[fragile]
  \frametitle{SQL DDL (Data Definition Language)}
  
  \begin{exampleblock}{Creating a table with constraints}
{\small
%###
\begin{verbatim}
CREATE TABLE solved (
  id INT AUTO_INCREMENT,
  name VARCHAR(40) NOT NULL,
  homework NUMERIC(2) NOT NULL,
  points NUMERIC(2) NOT NULL CHECK (points <= 10),
  PRIMARY KEY (id)
); 
\end{verbatim}
%###
}
  \end{exampleblock}
  Note the data types and constraints!

  \begin{center}
  \scalebox{.8}{
  \begin{tabular}{| c | c | c | c |}
  \rowcolor{mblue!20}
  \mc{4}{solved} 
  \\ \hline \rowcolor{mblue!40}
  \ul{id}  & name & homework & points 
  \\ \hline 
  \end{tabular}
  }
  \end{center}
  \pause\smallskip
  
  \begin{exampleblock}{Creating a view}
{\small
%###
\begin{verbatim}
CREATE VIEW solved_homework AS 
    SELECT id, name, homework FROM solved;
\end{verbatim}
%###
}
  \end{exampleblock}
\end{frame}