\documentclass[11pt]{amsart}
\usepackage{geometry}                % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper}                   % ... or a4paper or a5paper or ... 
%\geometry{landscape}                % Activate for for rotated page geometry
%\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{epstopdf}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}

% From http://tex.stackexchange.com/questions/20740/symbols-for-outer-joins
\def\ojoin{\setbox0=\hbox{$\bowtie$}%
  \rule[-.02ex]{.25em}{.4pt}\llap{\rule[\ht0]{.25em}{.4pt}}}
\def\leftouterjoin{\mathbin{\ojoin\mkern-5.8mu\bowtie}}
\def\rightouterjoin{\mathbin{\bowtie\mkern-5.8mu\ojoin}}
\def\fullouterjoin{\mathbin{\ojoin\mkern-5.8mu\bowtie\mkern-5.8mu\ojoin}}


\title{Homework 1}
\date{}                                           % Activate to display a given date or no date

\begin{document}
\maketitle

\section*{Instructions}

Due on Tuesday, October 19th, at 11:59pm

You must submit this assignment electronically, via Blackboard, as a PDF.

Some \LaTeX commands that you may find useful:

\begin{itemize}

\item{Basic Relational Algebra Operators ($\sigma, \Pi, \times, \cup, -, \rho$)}
\item{Additional RA Operators ($\bowtie, \cap, \fullouterjoin, G$)}

\item{Rename operation from class:

 $\Pi_{Name}(Monster) -
\Pi_{Monster.Name}(\sigma_{Monster.Level < X.Level}(Monster \times \rho_{X}(Monster)))$}

\end{itemize}

\section*{Questions}

\begin{enumerate}

\item{Ch.2, problem 2.8 and 2.14.d}

\begin{align*}
employee (person\_name, street, city) \\
works (person\_name, company\_name, salary) \\
company (company\_name, city) 
\end{align*}


Consider the employee database of in the above relation. Give an expression in the relational algebra to express each of the following queries:
\begin{enumerate}
\item Find the name of each employee who does not work for “BigBank”.
\item Find the name of each employee who earns at least as much as every employee in the database.
\item Find the name of each employee in this database who lives in the same city as the company for which she or he works.
\end{enumerate}

\item{Ch.2, problem 2.12}

\begin{align*}
branch(branch\_name, branch\_city, assets) \\
customer (ID, customer\_name, customer) \\
loan (loan\_number, branch\_name, amount) \\ 
borrower (ID, loan\_number) \\
account (account\_number, branch\_name, balance) \\
depositor (ID, account\_number)\\
\end{align*}

Consider the bank database of Figure 2.18. Assume that branch names and customer names uniquely identify branches and customers, but loans and accounts can be associated with more than one customer.

\begin{enumerate}
\item What are the appropriate primary keys?
\item Given your choice of primary keys, identify appropriate foreign keys.
\end{enumerate}

\item{Ch. 2, problem 2.15.c}
Find the ID of each depositor who has an account with a balance greater than \$6000 at the “Uptown” branch from the database above.

\item{Imagine that you are setting up a database to manage a restaurant's recipes.  Describe 5 tables that you would like to store.  Each table must have at least 5 attributes and each table must be linked to at least one other table in the database}

\end{enumerate}


\end{document}  