SQL as a Query Language




CS157a

Chris Pollett

Nov 4, 2019

Outline

Introduction

MySQL and Xampp

MySQL Databases

MySQL Command Line

MySQL Command Line

Quiz

Which of the following is true?

  1. `{1,1,2,3}` and `{1,2,2,3}` are the same bag.
  2. `gamma_{mbox{starName, COUNT(title)->ctTitle}}(StarsIn)` would output a two column relation: starName, ctTitle, representing for each starName the number of movies they were in.
  3. Given that we said in class that we don't allow datalog rules to have the same predicate in both their head and their tail, it is possible that all datalog rules in a datalog program are safe, yet a predicate in it represents an infinite set.

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