Click here to Skip to main content
15,867,780 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi. Must I learn SQL before node.js since the latter references SQL a lot? I hope to get your expertise.

What I have tried:

I have not tried anything, this is not applicable to the question. I hope my question remains valid.
Posted
Updated 20-Sep-22 4:36am

Technically, you don't really need to know SQL - but ... if you don't, you are going to make a huge number of mistakes which will complicate your life.

SQL is the way node.js talks to the DB, regardless of whether it is Sql Server or MySql - but learning SQL forces you to learn what a relational database is, and how it works. That means knowing how to store data efficiently, effectively, and securely - which is incredibly important if you want to do much beyond the database equivelant of "Hello World!".
And what seems really easy to do is often a mistake when you start to do more complex tasks. For example, it's pretty simple to set up a single table DB that stores everything in strings and just add your users data to it.
But when you later need to add sorting by date that becomes a real problem, because dates can be entered in many different ways: "1/2/3", "3-2-1", "2-1-3", and "1st Feb 2003" can all describe the same date and because string comparisons stop at the first different pair of characters they do not compare the same at all! Add in that the user might have typed "Dunno" instead and you start to see why just using the right datatypes is important.

There are lots of pitfalls like that waiting for the uneducated: unless you understand what a relational DB is and how it works you will fall into bear traps that mean you need to scrap huge swathes of your existing code because a production problem crops up - and by then your data is hopelessly compromised and may have to be scrapped as well!
Learning SQL helps you avoid the worst of those, so I'd say it's a good idea to get that down pat first.
 
Share this answer
 
Very detailed. I accept it. Thanks.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900