Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import Sequelize in a Node.js project.
Node.js
const Sequelize = require('[1]');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase 'Sequelize' instead of lowercase 'sequelize'
Using incorrect package names like 'sequelizejs'
✗ Incorrect
The npm package name for Sequelize is sequelize (lowercase).
2fill in blank
mediumComplete the code to initialize a Prisma client instance.
Node.js
const prisma = new [1](); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Sequelize' instead of 'PrismaClient'
Using just 'Prisma' without 'Client'
✗ Incorrect
To use Prisma, you create a new instance of PrismaClient.
3fill in blank
hardFix the error in this Sequelize model definition by completing the missing data type.
Node.js
const User = sequelize.define('User', { username: { type: Sequelize.[1], allowNull: false } });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or incorrect data type names
Using 'Text' instead of 'STRING'
✗ Incorrect
Sequelize data types are uppercase constants like STRING.
4fill in blank
hardFill both blanks to write a Prisma query that finds all users with age greater than 18.
Node.js
const adults = await prisma.user.findMany({
where: {
age: { [1]: [2] }
}
}); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'gte' instead of 'gt' for strictly greater than
Using a string '18' instead of number 18
✗ Incorrect
In Prisma, gt means 'greater than'. We compare age to 18.
5fill in blank
hardFill all three blanks to create a Sequelize model with a 'title' string and 'published' boolean fields.
Node.js
const Post = sequelize.define('Post', { title: { type: Sequelize.[1], allowNull: false }, published: { type: Sequelize.[2], defaultValue: [3] } });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase data types
Setting defaultValue to TRUE instead of false
✗ Incorrect
Use STRING for text and BOOLEAN for true/false. Default is false here.