Learn Sequelize - A NodeJS ORM | The Best Way to Write Database Queries

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ม.ค. 2025

ความคิดเห็น • 173

  • @programmercouple
    @programmercouple  3 ปีที่แล้ว +3

    If you're a read/write learner, don't worry we got you covered as well, with our articles/newsletters www.theimmigrantprogrammers.com/p/can-you-communicate-with-databases

  • @zirace3934
    @zirace3934 3 ปีที่แล้ว +7

    Honestly! I have been roaming around net, searching for sequelize solutions. Unfortunately I found none. Here I am, landed in your channel. I have no more words but appreciation for unconditional distribution of your knowledge. Thanks a lot. You have earn my subscription

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว

      Glad I could help! Thanks a lot for your kind words!:)

  • @techexec
    @techexec 2 ปีที่แล้ว +1

    I learnt about sequelize for the first time today, then came across your tutorial this evening, and I must say, 22mins here have replaced hours I spent earlier understanding the concepts. Thank you.

    • @programmercouple
      @programmercouple  2 ปีที่แล้ว

      Thanks a lot for your kind words, comments like these encourage us to keep creating more videos

  • @blueshadesable
    @blueshadesable 2 ปีที่แล้ว +5

    Fantastic tutorial. You explain everything so clearly before you take actions and begin to code. You give the viewers enough time to follow. Too many times in tutorials on You Tube, content creators will quickly click on other screens, making it hard to follow if we are either taking notes or coding along with you. This video was very well-paced. Thanks so much for sharing this. This vid made me subscribe to the channel :)

    • @programmercouple
      @programmercouple  2 ปีที่แล้ว

      Glad it was helpful!
      Your wonderful comment made my day :)

  • @Android-17
    @Android-17 2 ปีที่แล้ว

    This is the best introductory tutorial on Sequelize. PERIOD.

    • @programmercouple
      @programmercouple  2 ปีที่แล้ว +1

      Thanks so much! Appreciate the comment!:)

  • @alwayslernin6033
    @alwayslernin6033 2 ปีที่แล้ว +1

    I'm not sure if I have ever given feedback on a video before. But, everything about your style of teaching is just so good and so refreshing, that I had to comment! You are so easy to listen to and you do such a good job of explaining why you do at each step, often tying it back to the documentation rather than jus trying to fly through a bunch of high level stuff. I can't say it enough - You are really good at this and so helpful! Thank you and keep it up!

  • @rudradityajalan2188
    @rudradityajalan2188 3 ปีที่แล้ว +3

    Finally a short and nice guide on sequelize, thanks a lot for it!!

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว

      Thanks for your comment! We're happy to help!:)

  • @ianvieira283
    @ianvieira283 3 ปีที่แล้ว +6

    In love with your teaching skills, subscribed.

  • @deepakchawla1105
    @deepakchawla1105 3 ปีที่แล้ว +3

    thanks , really helped me , i wish you had a complete series of sequelize

  • @rakeshg9057
    @rakeshg9057 2 ปีที่แล้ว

    This is the best ever video on sequelize. All examples on sequelize on net are usually integrated with express server, it was difficult to differentiate sequelize code with server code bcoz they are messed up. Now this video resolved all my doubts. Thanks a lot. Love you couple.

    • @programmercouple
      @programmercouple  2 ปีที่แล้ว

      Glad it helped! Thanks for your comment Rakesh 😀

  • @ocoocososococosooooosoococoso
    @ocoocososococosooooosoococoso 3 ปีที่แล้ว +1

    this is the best tutorial I've seen about sequelize ever.

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว

      That's so kind! Thanks, we're very happy to help!:)

  • @ampagetech2624
    @ampagetech2624 ปีที่แล้ว

    Great tutorial , the screen was very clear and readable - an easy to follow tutorials , keep it up and thanks

  • @BlackZero880
    @BlackZero880 7 หลายเดือนก่อน

    I spent a day and came here with successfully creating tables❤ Thanks you very much! Subscribed you as well🎉

    • @programmercouple
      @programmercouple  7 หลายเดือนก่อน

      Glad to hear this! Appreciate the feedback!:)

  • @adityasoni3218
    @adityasoni3218 ปีที่แล้ว

    Wow, what a fantastic tutorial! 🙌 I've been struggling to wrap my head around Sequelize with Node.js, but this video made it incredibly easy to understand. The explanations were clear, and the step-by-step guidance was just what I needed to get started. Thanks to this tutorial, I feel much more confident in using Sequelize in my projects. Keep up the great work, and I'll definitely be checking out more of your content!" 👏📚🚀

  • @codekicks2171
    @codekicks2171 2 ปีที่แล้ว +1

    you have explained really well, please make videos on more topics, it really helps a lot

    • @programmercouple
      @programmercouple  2 ปีที่แล้ว

      Thank you for saying that, it boosts our will to make more content

  • @Randomize-md3bt
    @Randomize-md3bt 2 ปีที่แล้ว

    Thank you, I was struggling with Sequelize but I found your video and it helps me a lot

  • @MilaValentine
    @MilaValentine 3 ปีที่แล้ว +1

    Thank you for the help, I spent so much time trying to add data to the relationship tables, although it's not what you covered in the video, with the example you gave I was finally able to do it!

  • @superman1337H
    @superman1337H ปีที่แล้ว +1

    I am very grateful to you, because you explain it very well and easy to understand.

  • @qanol
    @qanol 2 ปีที่แล้ว

    best Sequelize on youtube , crystal clear

  • @ibraheemhajjar91
    @ibraheemhajjar91 ปีที่แล้ว

    thank you so much for simplicity and direct explanation, keep up the good work!

  • @rshekhar11
    @rshekhar11 3 ปีที่แล้ว

    By the way force sync is not always used, it is used only when you are planning to recreate the tables. If you see in the console it clearly states the drop table command and created it again. There is no need to drop tables for adding new records

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว

      If only you'd watched the video a little more, I did explain all of that in the video, in addition, to explaining why I am going to keep on using it in the video for demo purposes, so that we start fresh every time I re-run my script! Nevermind, thanks for your comment! Keep learning:)

    • @EpicToEdge
      @EpicToEdge ปีที่แล้ว

      @@programmercouple with v6 force true does not work, instead we are now using alter

  • @mraja6654
    @mraja6654 2 ปีที่แล้ว +1

    Hi, when i set force true it dropped every table. How to fix it and any idea about sequelize migration with typescript.

    • @programmercouple
      @programmercouple  2 ปีที่แล้ว

      You can just unset the force field, mark it as false.

    • @mraja6654
      @mraja6654 2 ปีที่แล้ว +1

      @@programmercouple Thanks for your reply, when i set force false it not add the new field in existing table.

  • @swuh87
    @swuh87 3 ปีที่แล้ว +1

    Thank you so much for the tutorial. You explain it so well. Was able to get through the part of my project I was stuck on for a couple of days. Thanks again

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว

      Thanks for your feedback! I’m glad it was helpful:)

  • @emanuelacosta2541
    @emanuelacosta2541 2 ปีที่แล้ว +1

    Hello! I love your content and your way of explaining things! Keep up the good work!

  • @mddawoodalam6283
    @mddawoodalam6283 3 ปีที่แล้ว +1

    Thank you for this amazing tutorial. Loved it and your way of teaching/explaining is very exciting to watch the video till the end. Thanks

  • @akulateja9011
    @akulateja9011 ปีที่แล้ว

    super awesome explanation mam 😍😍😍😍🤩🤩🤩🤩

  • @RahulGupta-pj1ux
    @RahulGupta-pj1ux 3 ปีที่แล้ว +1

    How can I perform select and insert queries on manually created tables? Do I need to define model for them? Or is there a way I can reference already existing table in my database?

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว +2

      Great question! Yes, so in order to use Sequelize even with the manually created tables you need to define the structure of the model inside your code.

    • @RahulGupta-pj1ux
      @RahulGupta-pj1ux 3 ปีที่แล้ว +1

      @@programmercouple Thank you. Can you also make a video about concepts like pooling and handling database connection error at production level using sequelize? It would be very helpful.

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว

      Noted

  • @amityadav-or2ys
    @amityadav-or2ys 3 ปีที่แล้ว

    really helpful, I would like to see more videos on sequelize.

  • @chavvobimbo5474
    @chavvobimbo5474 2 ปีที่แล้ว

    Hi, are you also able to retrieve the customer name & email with the order details, depending on the customerId foreign key?

  • @newagene8276
    @newagene8276 2 ปีที่แล้ว

    How can I define a model for already existing tables which have tons of data and which I cannot manupilate?

  • @abukhalidrifat3994
    @abukhalidrifat3994 10 หลายเดือนก่อน

    Is it okay if I write my relations inside the model that is after creating the schema. Will it work?

  • @mailercatch2424
    @mailercatch2424 3 ปีที่แล้ว +1

    The final select query is querying by orderId and not customerId, where clause is wrong.

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว +1

      Oops, made a mistake there!
      Thanks for letting us know 🙂

    • @beautifularabic5886
      @beautifularabic5886 3 ปีที่แล้ว

      @@programmercouple what can we do to correct that where clause? what should we write instead?

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว

      You could just say: Order.findAll( { where: { customerId } } )

  • @shravan.shandilya
    @shravan.shandilya 3 ปีที่แล้ว

    The force sync is going to dump data on restart. It works for this particular case or just for developer environment. Please make video about how migrations can be done using sequelize.

  • @charlesfreitas2092
    @charlesfreitas2092 2 ปีที่แล้ว

    Such a great tutorial, perfect. Thank you so much. Greetings from Brazil. ❤️

  • @hablu
    @hablu 2 ปีที่แล้ว

    Is there any option to query select data from tables of two different database

  • @chris_ea
    @chris_ea 2 ปีที่แล้ว

    Instead of Orders.findAll can you do findAllOrders on the ParentObject Customer?

  • @rahulk7348
    @rahulk7348 3 ปีที่แล้ว

    For Production Ready application we have to use Transaction concept. Could you please cover in your future video.

  • @abhisheksrivastava6659
    @abhisheksrivastava6659 2 ปีที่แล้ว

    I need a help from your side ,,, I have one table which may be join with many table ,, so I can't use association.. with two field it join that table ,,, .. then how to implement join .. in this regard ...

  • @namansingh8081
    @namansingh8081 2 ปีที่แล้ว

    Thank you so much for this tutorial, it was really helpful for understanding the syntax and working of sequelize.

  • @bkcy18
    @bkcy18 2 ปีที่แล้ว

    Any way to get the code from db itself? Like, I'm using vs as an ide and for .net applications there is an option to import the database as a model and we get c# classes for the tables. Is there a way to replicate that behavior with vscode (or any other ide) for sequelize

  • @reanibutani9555
    @reanibutani9555 3 ปีที่แล้ว

    Easy to understand explaination, I subscribed... Please make more tutorials.

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว

      Thanks!!! Anything in particular that you would like to learn??

  • @viekva
    @viekva 2 ปีที่แล้ว

    Best sequelize tutorial EVER

  • @cesarpintos8418
    @cesarpintos8418 3 ปีที่แล้ว +1

    Great explanation! Thank you very much, please use async await in next videos, promise chaining looks awful

  • @mustafaagha8834
    @mustafaagha8834 3 ปีที่แล้ว

    Which is better from performance and security prospective - using ORMs or Knexjs (or a likes) or using raw queries.
    For large scale projects

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว +1

      Hi Mustafa, thanks for your question.
      So, performance-wise RAW SQL will always be better hands down! ORMs are mostly used for the (abstraction) convenience they provide.
      For security, although, query builders and ORMs do offer some basic security, IMO that's something you need to take care of as a developer in all cases, no matter what you choose(Raw SQL/Query Builders/ORMs). You need to restrict as well as validate user inputs to avoid SQL Injection.
      However, most ORMs offer in-built support for Input/Schema Validation.
      Hope that answers your question!

    • @mustafaagha8834
      @mustafaagha8834 3 ปีที่แล้ว +1

      @@programmercouple thank you this was really helpful

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว

      We’re glad! Happy Programming:)

  • @kirthisa8674
    @kirthisa8674 3 ปีที่แล้ว

    Hi krithika Thanku for excellent explanation on sequelize, I'm a Beginner,I need to know Is hasmany works on Innerjoin concept,I need to Innerjoin two tables

  • @devanshusharma9098
    @devanshusharma9098 3 ปีที่แล้ว

    There is a query -select a.id, b.id ,b.name from a.products,b.users where a.id=1 and b.id = a.user_id(foreignkey). How can we write this in sequelize?

  • @akshaybisht2660
    @akshaybisht2660 2 ปีที่แล้ว

    What a lovely tutorial. Loved the content just did not understood how did you made foreign key by customer id on order table from customer id field? Explain me this and you have new subscriber as well. Appreciate your lovely content 💖

    • @programmercouple
      @programmercouple  2 ปีที่แล้ว

      This might help you better understand the concept:
      sequelize.org/master/manual/assocs.html#special-methods-mixins-added-to-instances

  • @saimanish3385
    @saimanish3385 3 ปีที่แล้ว +1

    Hi Madam.Thank you very much for sharing the knowledge with us.Please make a video on creating a model for already existing table structure which is managed by DBA people in production environment.

  • @sameera-dananjaya-wijerathna
    @sameera-dananjaya-wijerathna 3 ปีที่แล้ว

    really helpful resource. from Sri lanka

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว

      Hello there, thanks for your comment! Happy to help!:)

  • @virenkamra5050
    @virenkamra5050 9 หลายเดือนก่อน

    Just a suggestion in 15:20 this is not the right way to create an order and customer must be the one creating an order instead of tweaking the table directly via Order.create() when you return the customer promise with return Customer.create({ values }) on line number 12 you receive a customer sequelized value so in the next then block where youre adding the Order must be like
    customer.createOrder({ values if required }) where createOrder is a method developed by sequelize under the hood in relation to your second Tables named Order with preceding keyword create

  • @raulgogna3420
    @raulgogna3420 3 ปีที่แล้ว

    Good video and clear knowledge. Do you recommend this language to connect as a backend with Flutter Front-End for an App mobile?

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว

      Thanks!
      Any database can be used with Flutter. The real answer depends on the kind of application you're planning to build. That alone can decide if SQL or NoSQL is better for you.

  • @programmingwithnit5308
    @programmingwithnit5308 ปีที่แล้ว +1

    Good for me

  • @loribryant4999
    @loribryant4999 ปีที่แล้ว

    I thing id object is no need to add for the model

  • @cheeaunlee7530
    @cheeaunlee7530 2 ปีที่แล้ว

    How to organize models using different schemas? Example: accounts.payments, sales.payments, same table name, different schema

  • @parthokr
    @parthokr 3 ปีที่แล้ว

    Wow so professional. Thank you.

  • @SavageStar245
    @SavageStar245 ปีที่แล้ว

    Amazing Tutorial, it gave me a smile when u mentioned Chandler Bing 😁 #FriendsFan

  • @surajgadage6004
    @surajgadage6004 3 ปีที่แล้ว +1

    Great explanation Thank you ☺️

  • @mouri_p
    @mouri_p 3 ปีที่แล้ว +1

    Nice and clean👏

  • @codemoor
    @codemoor 3 ปีที่แล้ว

    How Can I Use Json

  • @habitzenglish5986
    @habitzenglish5986 2 ปีที่แล้ว +1

    please make new video about relational db

  • @beamer5404
    @beamer5404 3 ปีที่แล้ว +1

    You need not use --save for saving in the dependency list, it's default now. For dev dependency, you need such explicit flag, like -D.

  • @shihabudheen3
    @shihabudheen3 2 ปีที่แล้ว

    Lovely tutorial😍

  • @akashaher1001
    @akashaher1001 2 ปีที่แล้ว

    Hello mam...
    I liked your content... 💯
    How can I use one sequelize model for creating multiple tables?
    Because I just want to store records year wise in separate table. all the fields are same. I want to use same model instance for that

  • @janakiraman2482
    @janakiraman2482 2 ปีที่แล้ว

    Good explanation. Thanks

  • @karankate4838
    @karankate4838 2 ปีที่แล้ว

    Thanks you soo much for the tutorial its very helpful for me 🥰

  • @Infinite1
    @Infinite1 2 ปีที่แล้ว +1

    Im new to Sequelize and the Video helped me a lot but I come to one question. What if I have multiple orders? Say if the same Person has 2 Orders howto associate the second with the rest?

  • @tamaldas3544
    @tamaldas3544 3 ปีที่แล้ว

    need tutorial from scratch ....how you have built the project structure ?

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว

      You can google the best practices to create project structures in NodeJs. This is a really good article on this topic blog.logrocket.com/the-perfect-architecture-flow-for-your-next-node-js-project/

  • @sriram-ze5dq
    @sriram-ze5dq 3 ปีที่แล้ว

    Its shows as sequelize.define is not a function error

    • @programmercouple
      @programmercouple  3 ปีที่แล้ว

      Checkout this link - stackoverflow.com/questions/49470508/sequelize-define-is-not-a-function
      Also, check that you're not making any obvious mistakes.

  • @abhisheksrivastava6659
    @abhisheksrivastava6659 2 ปีที่แล้ว

    hmm .. can you please explain us how to sanitize data in standard form ... :( ...

  • @vishtigote2450
    @vishtigote2450 3 ปีที่แล้ว

    Thanks you so much for this. but I have noticed one thing in the util file you have accidently keep you phone number as password if it is genuine then please clear that password.

  • @siddheshmhatre2389
    @siddheshmhatre2389 3 ปีที่แล้ว +2

    best one💥

  • @beautifularabic5886
    @beautifularabic5886 3 ปีที่แล้ว +1

    Thank you for the amazing video! Amazing explanation! Excellent teaching skills.

  • @akchelsea6635
    @akchelsea6635 3 ปีที่แล้ว +1

    Thank you so much, that helps a lot

  • @toushikahmedpronoy667
    @toushikahmedpronoy667 6 หลายเดือนก่อน

    thanks for making it so simple

  • @oussemaayari4838
    @oussemaayari4838 2 ปีที่แล้ว

    you're awesome, keep going

  • @YishaiYT
    @YishaiYT 2 ปีที่แล้ว

    so clear. thanks a lot !

  • @venkateshe7506
    @venkateshe7506 3 ปีที่แล้ว

    Simple and neat. Thank you

  • @arihantjain8347
    @arihantjain8347 2 ปีที่แล้ว

    Nice..🙌

  • @prabhasinigiri9011
    @prabhasinigiri9011 3 ปีที่แล้ว

    Awesome video ..

  • @pavanshinde
    @pavanshinde 3 ปีที่แล้ว

    Great video... thanks

  • @akashrajawat3004
    @akashrajawat3004 ปีที่แล้ว +1

    customer.createOrder didn't worked for me,
    It's giving me type error saying customer.createOrder is not a function

  • @WilcoGroothand
    @WilcoGroothand 3 ปีที่แล้ว

    Perfect to start with. thx

  • @javierrusso9576
    @javierrusso9576 3 ปีที่แล้ว

    Thanks a lot 4 this.tutorial!

  • @mohamedyoussef8835
    @mohamedyoussef8835 ปีที่แล้ว

    Awesome video ++++++++++++++ 🙂

  • @muhammadomarazhar8320
    @muhammadomarazhar8320 13 วันที่ผ่านมา

    Amazing, thank you

    • @programmercouple
      @programmercouple  13 วันที่ผ่านมา

      Glad you found it helpful!🙌🏻

  • @kunalrajput4539
    @kunalrajput4539 2 ปีที่แล้ว

    great video

  • @s1nistr433
    @s1nistr433 2 ปีที่แล้ว

    Good video but createOrder does not work at all

  • @sergeykiparenko1195
    @sergeykiparenko1195 2 ปีที่แล้ว

    You are the best

  • @programmingwithnit5308
    @programmingwithnit5308 ปีที่แล้ว

    Thank you

  • @pinnumishra4563
    @pinnumishra4563 2 ปีที่แล้ว

    Thanks 😊

  • @csstudios7429
    @csstudios7429 ปีที่แล้ว

    thanks a lot mam

  • @dorbenmoyal7639
    @dorbenmoyal7639 3 ปีที่แล้ว +1

    Thanks...!

  • @chris_ea
    @chris_ea 2 ปีที่แล้ว

    Thanks!

  • @fiendsgaming7589
    @fiendsgaming7589 2 ปีที่แล้ว

    thnx

  • @sanjayism
    @sanjayism 3 ปีที่แล้ว

    TypeError: Customer.hasMany is not a function
    at
    how get rid of this error

  • @hovhannisyanprod9024
    @hovhannisyanprod9024 2 ปีที่แล้ว

    !

  • @balajic4684
    @balajic4684 3 ปีที่แล้ว

    do upsert and then only this video will be true waste of time !

  • @crypto.vip-class
    @crypto.vip-class ปีที่แล้ว

    TypeError: sequelize.define is not a constructor ?? some help ??