Retrieve Records From Tables in Sequelize

Sequelize·3 min read·Jan 1, 2025

For this lesson, let's consider this MySQL table named employees:

CREATE TABLE employees (  id INT AUTO_INCREMENT PRIMARY KEY,  first_name VARCHAR(255) NOT NULL,  last_name VARCHAR(255) NOT NULL,  department ENUM('Sales', 'Engineering', 'HR', 'Marketing') NOT NULL,  hire_date DATE NOT NULL,  salary INT NOT NULL);

That contains these SQL records:

mysql> SELECT * FROM employees;+----+------------+-----------+-------------+------------+--------+| id | first_name | last_name | department  | hire_date  | salary |+----+------------+-----------+-------------+------------+--------+|  1 | John       | Doe       | Sales       | 2022-01-15 | 50000  ||  2 | Jane       | Smith     | Engineering | 2020-03-22 | 70000  ||  3 | Alice      | Johnson   | HR          | 2019-07-30 | 45000  ||  4 | Bob        | Brown     | Sales       | 2018-11-10 | 52000  |

Unlock the program 🚀

Pay once, own it forever.

€79

30-day money-back guarantee

  • 13 modules
  • 113 lessons with full-code examples
  • 29 projects with commented solutions
  • All future lesson and project updates
  • Lifetime access

By submitting this form, you agree to the Terms & Conditions and Privacy Policy.