[Mysql] I have a doubt
#1

I have a doubt,I am doing a roleplay project, I am executing the creation of the tables by the script, however I am creating a dynamic faction system, but I want to create a specific table for each faction, for example, instead of leaving all the factions together in a table, I intend create the table with the name of the faction and in it contain the Principal, members, but the question is in, how will I create a table also to the rank of the faction.
Reply
#2

Portuguese board: https://forum.sa-mp.com/forumdisplay.php?f=34
Reply
#3

no dont create different tables for factions

simple example of possible table structure

table : factions
factionID
factionName
factionType

table : faction_ranks
factionID
rankLevel
rankName
rankPayCheck

table : faction_members
factionID
userRank
userID
userPayCheck

table : faction_positsions // for example car repair points, equipment points etc
factionID
posText
posType
posX
posY
posZ
posVW
posInt

and with such structure nothing isnt limited in factions
you can add as many positsions members ranks as possible into your faction.
Reply
#4

You do not create a new table for each user, do you? You should follow the same rules when designing a database.

You cannot have information about a faction and all its members in only one table without duplicates. What you need is two tables. The parent table which contains faction ID (generated by auto increment), its name and other information such as color etc. The child table is linked with faction ID (foreign key) and contains faction ID, user ID and rank.
Reply
#5

well when you build dynamic faction system, were people can be in many factions then its good to create other table.
Reply
#6

Hey guys, thanks for the help of all, clarify my doubts perfectly.
Reply
#7

You are better off creating all the factions in the same table and link each one of them to some other table, after all, MySQL's power resides in its descriptive nature of being called a relational database.
Reply
#8

Why do you want to create a table for each faction if you can create just one table 'factions' with all fields you need (id, name, hq pos, rank-names, interior, etc)?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)