How do I select a column using an alias
Table.findAll({ attributes: ['id', ['first', 'firstName']] //id, first AS firstName}).then(function(posts) { res.json(posts);});
Also Sequelize supports defining column names directly on the model definition too.
Sequelize Docs On that they mention about field
attribute on column definition.
ex: (Taken from Docs itself)
const { Model, DataTypes, Deferrable } = require("sequelize");class Foo extends Model { }Foo.init({ // You can specify a custom column name via the 'field' attribute: fieldWithUnderscores: { type: DataTypes.STRING, field: 'field_with_underscores' },}, { sequelize, modelName: 'foo'});
thanks to this answer