\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{array}
\usepackage{adjustbox}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm,a4paper]{geometry}
\usepackage{amsmath}
\usepackage{verbatim}
\usepackage{courier}

\usepackage{listings}
\usepackage{xcolor}

\lstdefinestyle{freefempp}{
	language=SQL,
	basicstyle=\footnotesize\ttfamily,
	commentstyle=\itshape\color{gray},
	keywordstyle=\color{blue},
	numberstyle=\color{red},
	stringstyle=\color{red},
	identifierstyle=\color{violet},
	showstringspaces=false,
	%float,
	%frame=single,
	%numbers=left
}

\lstset{
	basicstyle=\footnotesize\ttfamily,
	columns=flexible,
	breaklines=true,
	inputencoding=utf8,
	extendedchars=true,
	literate={á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1 {ñ}{{\~n}}1 {Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1 {Ñ}{{\~N}}1,
	style=freefempp
}

\usepackage{titling}
\renewcommand\maketitlehooka{\null\mbox{}\vfill}
\renewcommand\maketitlehookd{\vfill\null}

\usepackage{hyperref}
\hypersetup{colorlinks=true,allcolors=black}
\usepackage{hypcap}

\title{\textbf{Proyecto Semestral de Base de Datos\\Entrega 2}}
\author{Christopher Cromer\\\\Profesoras Mónica Caniupán y Valeria Beratto\\Ingeniería Civil Informática}
\date{\today}

\pretitle{%
	\begin{center}
		\LARGE
		\includegraphics[width=4cm]{ubblogo.png}\\[\bigskipamount]
	}

\posttitle{\end{center}}

\begin{document}
\clearpage
\hypersetup{pageanchor=false}
\begin{titlingpage}
\maketitle
\end{titlingpage}
\thispagestyle{empty}

\newpage

\clearpage
\thispagestyle{empty}
\tableofcontents

\newpage
\hypersetup{pageanchor=true}
\pagenumbering{arabic}
\section{Introducción}
El objetivo de este trabajo es modelar un sistema para los colegios municipales de la región del Bío-Bío con el propósito de almacenar y consultar en una base de datos de PostgreSQL con información el colegio.

\newpage
\section{Consultas}

\subsection{Consulta \texorpdfstring{$Q_1$}{$Q_1$}}
\lstinputlisting{q1.sql}

\subsubsection{Resultado de \texorpdfstring{$Q_1$}{$Q_1$}}

\begin{center}
	\includegraphics[width=0.90\textwidth,height=0.90\textheight,keepaspectratio]{q1.png}
\end{center}

\subsection{Consulta \texorpdfstring{$Q_2$}{$Q_2$}}
\lstinputlisting{q2.sql}

\subsubsection{Resultado de \texorpdfstring{$Q_2$}{$Q_2$}}

\begin{center}
	\includegraphics[keepaspectratio]{q2.png}
\end{center}

\newpage

\subsection{Consulta \texorpdfstring{$Q_3$}{$Q_3$}}
\lstinputlisting{q3.sql}

\subsubsection{Resultado de \texorpdfstring{$Q_3$}{$Q_3$}}

\begin{center}
	\includegraphics[keepaspectratio]{q3.png}
\end{center}

\subsection{Consulta \texorpdfstring{$Q_4$}{$Q_4$}}
\lstinputlisting{q4.sql}

\subsubsection{Resultado de \texorpdfstring{$Q_4$}{$Q_4$}}

\begin{center}
	\includegraphics[keepaspectratio]{q4.png}
\end{center}

\newpage

\subsection{Consulta \texorpdfstring{$Q_5$}{$Q_5$}}
\lstinputlisting{q5.sql}

\subsubsection{Resultado de \texorpdfstring{$Q_5$}{$Q_5$}}

\begin{center}
	\includegraphics[keepaspectratio]{q5.png}
\end{center}

\subsection{Consulta \texorpdfstring{$Q_6$}{$Q_6$}}
\lstinputlisting{q6.sql}

\subsubsection{Resultado de \texorpdfstring{$Q_6$}{$Q_6$}}

\begin{center}
	\includegraphics[keepaspectratio]{q6.png}
\end{center}

\newpage
\section{Script SQL}

\subsection{Crear tablas}

\lstinputlisting{crear_tablas.sql}

\newpage
\subsection{Insertar duplas}

\lstinputlisting{insertar_duplas.sql}

\end{document}

