SQL basics

  • statements = top level
    • CREATE = new tables
    • INSERT = add data
    • SELECT = retrieve data
      • aka “queries”
flights |> show_query()
## <SQL>
## SELECT *
## FROM flights
planes |> show_query()
## <SQL>
## SELECT *
## FROM planes
  • WHERE = filter()
  • ORDER BY = arrange()
flights |> 
  filter(dest == "IAH") |> 
  arrange(dep_delay) |>
  show_query()
## <SQL>
## SELECT flights.*
## FROM flights
## WHERE (dest = 'IAH')
## ORDER BY dep_delay