SQL as a Query Language




CS157a

Chris Pollett

Nov 5, 2018

Outline

Introduction

MySQL and Xampp

MySQL Databases

MySQL Command Line

MySQL Command Line

Quiz

Which of the following is true?

  1. Datalog only works with sets as relations; whereas, the relational algebra can also work with bags.
  2. Suppose `R(A,B)` has `n` tuples and `S(B,C)` has `m` tuples and none of the tuples in either relation will join with each other. Then the number of rows in the outer join will be `n+m`.
  3. We can express `R(A,B) cup S(A,B)` in Datalog as: `T(A,B) <- R(A,B), S(A,B)`.

Simple Queries in SQL

Projections and More on Selection

Strings and Pattern Matching in SQL

Dates, Times

NULL, UNKNOWN in SQL

Ordering Output in SQL