Divide SQL data in different tables

Fox :

I want to split users' data in different tables so that there isn't an huge one containing all data...

The problem is that in tables different from the main one I can't recognize who each data belongs to.

Should I store the same user id in every table during the signup? Doesn't it create unnecessary duplicates?

EDIT: example

table:

| id | user | email | phone number| password | followers | following | likes | posts |

becomes

table 1:

| id | user | email | phone number| password |

table 2:

| id | followers num | following num | likes num | posts num |
Morpheus :

I think you want to use a LEFT JOIN

SELECT t1.[user], t2.[posts]
FROM Table1 AS t1
LEFT JOIN Table2 AS t2 ON t1.id= t2.id

EDIT: Here is a link to documentation that explains different types of JOINS

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=25579&siteId=1