This document discusses SQL queries and Datalog rules. It begins with examples of simple SQL queries on a BROWSER_TABLE relation. More complex queries are demonstrated using joins, subqueries, aggregation, and set operations. Transaction processing and ensuring isolation levels are covered. The document then introduces Datalog, a logical query language, and how its rules can extend SQL with recursion to express queries not possible in SQL alone. Key concepts in Datalog like the distinction between extensional and intensional databases, computing rules bottom-up and top-down, and ensuring safe rules are explained. Finally, examples are given of expressing Datalog rules and recursive queries using the SQL WITH clause.