[Mysql] I have a doubt - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Mysql] I have a doubt (
/showthread.php?tid=662934)
[Mysql] I have a doubt -
DanielMatrix - 16.01.2019
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.
Re: [Mysql] Eu tenho um -
G4M30V3R - 16.01.2019
Portuguese board:
https://forum.sa-mp.com/forumdisplay.php?f=34
Re: [Mysql] I have a doubt -
codExpert - 16.01.2019
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.
Re: [Mysql] I have a doubt -
Calisthenics - 16.01.2019
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.
Re: [Mysql] I have a doubt -
codExpert - 16.01.2019
well when you build dynamic faction system, were people can be in many factions then its good to create other table.
Re: [Mysql] I have a doubt -
DanielMatrix - 16.01.2019
Hey guys, thanks for the help of all, clarify my doubts perfectly.
Re: [Mysql] I have a doubt -
Eoussama - 16.01.2019
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.
Re: [Mysql] I have a doubt -
L0K3D - 16.01.2019
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)?