r/learnprogramming • • 26d ago

react or sql what should i learn first

2nd year it student know both js and java what should i learn first confused a bit sql will take time and can't develop project immediately but and it takes a lot of time will react is easy

0 Upvotes

19 comments sorted by

9

u/gm310509 26d ago

Why do you believe SQL will be hard?

The language itself is pretty straightforward. You do have to think in terms of sets of data (as opposed to records in a file) and that can take a moment for the penny to drop for some, but the language itself is pretty basic.

For example

Select C.*, a.*
From customer C join Account A on
    C.cust_id = A.cust_id
Order by c.cust_id, a.balance
;

There I just wrote the equivalent of a few hundred lines of java code (maybe even thousands depending upon the file format) that prints all customers along with their account details sorted in ascending order of customer id and account balance. The equivalence being that the Java version doesn't use a database rather you write the entire file handling and data handling yourself.

4

u/No_Candle9908 26d ago

Backend dev here. I’d push back a little on “SQL will take a long time”. The part you need for projects (SELECT with WHERE, JOIN, GROUP BY, INSERT/UPDATE, a primary key and a foreign key) is a weekend or two. The deep stuff like indexes and query plans comes later, when you actually hit a slow query.

You also don’t have to pick. Build one small app that needs both: a React page that talks to a Java (Spring Boot) or Node API, backed by Postgres or SQLite. A todo list with users is enough. You’ll learn more from wiring the three together than from either one alone.

If you really want an order: basic SQL first. Almost every app stores data, and a bad table design hurts for years, while a messy React component is easy to rewrite.

1

u/Green_Chamomile 26d ago

The bad table design point is so real. Classic one in a todo app is putting the username as text on every todo row instead of a user_id that points to a users table. Works fine until someone changes their username and half their todos look like they belong to nobody.

4

u/csabinho 26d ago

You'll need SQL for anything that has a database in the backend. It's not hard, but it's a basic requirement for such stuff. Learn both side by side. They don't really interfere.

2

u/Dissentient 26d ago

Work on a project that uses both and learn both as you go. Read the bare minimum you need to make progress when stuck and go back to code immediately.

Almost all learning outside of writing code is worthless compared to the actual practice of writing code and building stuff.

1

u/CycloCyanide 26d ago

Most companies are heavily invested is some form of SQL style database. MsSqL, MySqL, Postgres to name a few. Almost every program I have written in my career is talking to one of these databases.

1

u/Boolean26 26d ago

Both will be irrelevant till u graduate

0

u/epic-watermelon 26d ago

Why?

1

u/Boolean26 26d ago

I don't see sql or react as something which will be out of reach of AI

1

u/epic-watermelon 26d ago

How will he spot problems in some react code or SQL queries if he doesn’t know how it works?

-1

u/Boolean26 26d ago

There will not be problems to spot, I think , in 2 years time

1

u/Xtreme_Neon 26d ago

if you already know js, i'd start with react since you can see results quickly and build small projects that keep you motivated. but learn basic sql alongside it, even just select, insert, joins and a simple table design, because almost every real project ends up needing a database. a good order is a small react app first, then add a backend with sqlite or postgres so you learn sql with a real reason to use it.

1

u/Available_Safe1818 25d ago

Neither one should be difficult or that urgent that you learn...

1

u/mjmvideos 26d ago

Learn the thing that will help you more immediately. Are you developing a dynamic web site? Learn react. Are you developing an application that needs to deal with large amounts of tabular data? Learn SQL.

0

u/veloxVolpes 26d ago

So these are two completely different things, it's a bit like asking if you should take up fencing or get into chess. What are you looking to achieve? SQL is for interacting with databases and retreving information, and React is a framework for building websites with JavaScript. If you don't know it already I would learn JavaScript first. Any further steps require more information