This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Repo.delete_all(from e in "employee", | |
where: e.last_name == "Wayne") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Repo.update_all(from(e in "employee", | |
where: e.first_name == "Steve"), | |
set: [department_id: 2]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Repo.insert_all("department", [[name: "Human Resources"]]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Repo.all(from d in "department") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT department_id, name FROM department |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Repo.all(from d in "department", select: [d.department_id, d.name]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias EctoTest.Repo | |
import Ecto.Query | |
Repo.all(from d in "department", select: [d.department_id, d.name]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex -S mix |