%% This LaTeX-file was created by <jl> Thu Feb 27 15:49:23 1997
%% LyX 0.10 (C) 1995 1996 by Matthias Ettrich and the LyX Team

%% Don't edit this file unless you are sure what you are doing.
\documentclass[12pt,letterpaper,oneside,onecolumn]{article}
\usepackage[]{fontenc}
\usepackage[dvips]{epsfig}

%%
%% BEGIN The lyx specific LaTeX commands.
%%

\makeatletter
\def\LyX{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\spacefactor1000}%
\newcommand{\lyxtitle}[1] {\thispagestyle{empty}
\global\@topnum\z@
\section*{\LARGE \centering \sffamily \bfseries \protect#1 }
}
\newcommand{\lyxline}[1]{
{#1 \vspace{1ex} \hrule width \columnwidth \vspace{1ex}}
}
\newenvironment{lyxbibliography}
{
\begin{thebibliography}{99}}
{\end{thebibliography}}
\def\lxq{"}
\newenvironment{lyxcode}
{\list{}{
\rightmargin\leftmargin
\raggedright
\itemsep 0pt
\parsep 0pt
\ttfamily
}%
\item[]
}
{\endlist}
\newcommand{\lyxlabel}[1]{#1 \hfill}
\newenvironment{lyxlist}[1]
{\begin{list}{}
{\settowidth{\labelwidth}{#1}
\setlength{\leftmargin}{\labelwidth}
\addtolength{\leftmargin}{\labelsep}
\renewcommand{\makelabel}{\lyxlabel}}}
{\end{list}}
\newcommand{\lyxletterstyle}{
\setlength\parskip{0.7em}
\setlength\parindent{0pt}
}
\newcommand{\lyxaddress}[1]{
\par {\raggedright #1 
\vspace{1.4em}
\noindent\par}
}
\newcommand{\lyxrightaddress}[1]{
\par {\raggedleft \begin{tabular}{l}\ignorespaces
#1
\end{tabular}
\vspace{1.4em}
\par}
}
\newcommand{\lyxformula}[1]{
\begin{eqnarray*}
#1
\end{eqnarray*}
}
\newcommand{\lyxnumberedformula}[1]{
\begin{eqnarray}
#1
\end{eqnarray}
}
\makeatother

%%
%% END The lyx specific LaTeX commands.
%%

\pagestyle{plain}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\begin{document}

SQL made by IBM in the system R project.

includes relational algebra and tuple calculus

The data definition language includes:

\begin{itemize}

\item create table (define columns)

\item alter table (add columns)

\item create index (indexes relation based on attributes)

\item create view (make virtual relation)

\end{itemize}

no deletion because you can always just do a projection

The data manipulation language is:

\begin{itemize}

\item insert into values -adds a tuple

\item delete(relation) where(conditions on attributes) -removes tuples

\item update set(new values) where(selects tuples) -modify tuples

\item select from(relations) where(selection criteria) -subset (performs
selection and join)

\end{itemize}

Also some aggregate operations (used with select)

\begin{itemize}

\item count

\item min

\item max

\item avg

\item sum

\end{itemize}

Set operations

\begin{itemize}

\item in

\item exists (element contained)

\item not exists

\item contains (subset check)

\item not contains

\item union

\item intersect

\item minus

\end{itemize}

example:

who makes more than Jacque?

Select e1.Name, e1.PayRate

From EMPLOYEE e1, EMPLOYEE e2

where e1.PayRate \(>\) e2.PayRate AND e2.Name=''Jacques''

Another example:

want itemized bills from employee \#3

Relations: 

\begin{itemize}

\item Bill -\(>\) bill \#, Employee \#, date, total\$

\item Reciepts -\(>\) bill\#, item\#, qty

\item inventory -\(>\)item\#, item description, item cost

\end{itemize}

select receipt.item\#, inventory.item\_desc,qty,item\_cost, qty*item\_cost,bill.bill\#

from bill, receipt, inventory

where employee\#=3 and date=2/21/97

\end{document}
