Skip to content

Instantly share code, notes, and snippets.

View abadongutierrez's full-sized avatar
💻
working

Rafael Gutiérrez abadongutierrez

💻
working
View GitHub Profile
Repo.delete_all(from e in "employee",
where: e.last_name == "Wayne")
Repo.all(from e in "employee",
join: d in "department", on: e.department_id == d.department_id,
where: d.department_id == 2,
select: [e.first_name, e.last_name, d.name])
Repo.update_all(from(e in "employee",
where: e.first_name == "Steve"),
set: [department_id: 2])
Repo.insert_all("employee", [[first_name: "Steve", last_name: "Jobs", hire_date: {1976, 1, 4}, department_id: 1]])
Repo.insert_all("employee", [[first_name: "Steve", last_name: "Wozniak", hire_date: {1976, 1, 4}, department_id: 1]])
Repo.insert_all("employee", [[first_name: "Ronald", last_name: "Wayne", hire_date: {1976, 1, 4}, department_id: 1]])
Repo.insert_all("department", [[name: "R&D"]])
Repo.insert_all("department", [[name: "Human Resources"]])
Repo.all(from d in "department")
SELECT department_id, name FROM department
Repo.all(from d in "department", select: [d.department_id, d.name])
alias EctoTest.Repo
import Ecto.Query
Repo.all(from d in "department", select: [d.department_id, d.name])