Jump to content

Recommended Posts

Posted

Hello Maxcheaters.in this guide i will show you sql commands thats helps you to find/update/create things.

so lets start.

 

1.SQL command - ALTER TABLE

 

Table structure can be changed by using alter command. With this command Field type or property can be changed or a new field can be added. This sql alter table command is used like create table command.

 

for example we need to change banchat_time field name to ban_time:

 

ALTER TABLE `characters` CHANGE `banchat_time` `ban_time` DECIMAL( 20, 0 ) NULL DEFAULT '0'

 

2.SQL command - BETWEEN

 

Many times we may require to find out records between a range of value.  We can specify one upper limit and one lower limit and the query should return all the records between these two values. The sql BETWEEN command will give us the required result in all these cases. We will apply here BETWEEN command to a numeric field and see how the records are returned from a Mysql table.

 

for example we need to see all items enchantet from 20 to 25:

 

SELECT * FROM `items` WHERE enchant_level BETWEEN 20 and 25

 

3.SQL command - COUNT

 

We can count the number of records in a table with different combinations. Let us first count the total number of records in the table with this count command.

 

for example we need to see count of noblesee characters:

 

SELECT count(*) FROM `characters` WHERE nobless = '1'

 

4.SQL command - DELETE

 

Delete query is used to delete records from the table. This query is used along with some condition to selectively delete records from the table. To delete all the records from the table we can use truncate command like this

 

TRUNCATE `characters`

 

This will remove all the records from the table. This is one way of deleting all the records from a table. Now let us try to delete records based on some selection.

 

Now let us delete all characters hows lvl less then 70:

 

DELETE FROM characters WHERE level < 70

 

5.SQL command - DROP

 

We have seen how to remove records from a table by using truncate sql command. Now we will learn how to use DROP query command to delete a table or a field or some other properties associated with the table. Let us start with deleting a field by DROP command.

 

ALTER TABLE `characters` DROP `ViP`;

 

Here characters is our table name and ViP is one of the field of this table. By this command we can delete the field ViP of the table characters.

 

Deleting a Table

We can use DROP command to remove a table inside the database. Now here is the code to delete the table characters.

 

DROP table characters

 

6.SQL command  - HAVING

 

We can use sql having command to add condition to the query. The advantage of using HAVING command is it can be used in aggregate functions like count, max etc. We can't use SQL WHERE clause here. This way we can add value to our select command as per requirement.

 

For example we need to see all npcs names and levels thats level is upper when 70

 

SELECT name,level FROM npc GROUP BY name HAVING level > 70

 

7.SQL command - INSERT

 

INSERT command is used to append or add a record to a database. A new record will be added at the end of the table every time INSERT command is used. We have to specify what are the fields to be filled while inserting the record, we can add records even without specifying the field names but we have to maintain the order of the field existed in the table and the the order of the data we are inserting. We have to take care of proper formatting of the data we are inserting to the table. We can't insert a string to a numeric field. So we have to format the data and apply the insert command.

 

for example you want to add you characters olympiad points

 

INSERT INTO olympiad_nobles (`char_id`, `class_id`, `char_name`, `olympiad_points`, `competitions_done`) VALUES ('1111','128','Leki','22','9');

 

8.SQL command - IN

 

SQL IN statement can be used with where clause to list a set of matching records of a table. We can use SQL in query with NOT  combination also to filter out some records.

 

for example you want to see characters that are heroes.

 

SELECT * FROM characters WHERE obj_Id IN (SELECT char_id FROM heroes)

 

9.SQL command - LIKE

 

LIKE sql command is used to retrieve or match records in different combinations to get desired result with wildcard. We will try LIKE sql query command and how to use it in our MySQL tables. But the best way to use LIKE query command is to apply it in a text or varchar field along with wildcard %.

 

for example you want to view all gludio clanhalls

 

SELECT * FROM clanhall WHERE location LIKE '%Gludio%'

 

10.SQL command - MAX

 

Some time we will be searching for the maximum value in a field of any MySql table. MAX sql command will return the record with  maximum or highest value in the SQL table.

 

for example you want to see best pvp in server

 

SELECT MAX(pvpkills) FROM characters

 

11.SQL command - MIN

 

Minimum value in a numeric field can be collected by applying  MIN sql command. We will try MIN sql command and how to use it in our tables. But the best way to use MIN command is to apply it in a numeric field.

 

for example you want to know which armor have less pdef

 

SELECT MIN(p_def) FROM armor

 

12.SQL command - UPDATE

 

Update command in SQL is used to change any record in the table. Records are to be manipulated or updated using update command. Conditional update is the most common type of update command used in MySQL also. You are requested to go through the SQL WHERE command before using update command as both are to be used in proper combinations. Here is one simple command but before trying this please understand the implication of this. Without using any where command (or without using any restriction) the command will change all the records of the table. So let us start with the simple command.

 

UPDATE char_templates SET STR="10"

 

This command will change all the records of the table char_templates and will change all the STR field to 10. This is not what is required in common cases so we will be changing records based on some conditions.now we will change all classes MEN to 50 WHERE classes have MEN 40. Our command should selectively update those records for which MEN is equal to “40” and will update them to “50”. We will use one where clause along with update command for updating the records.

 

UPDATE char_templates SET MEN="50" WHERE MEN="40";

 

This command will update only those records for which MEN is equal to '40'. So this way we can update records selectively. Now let us move one more step and change the records selectively based on some value in some other field. We will change records for which MEN is equal to '40' and P_ATK is more than 3. We will promote those classes only who has got more than or equal to 3 P_ATK.

 

UPDATE char_templates SET MEN="50" WHERE MEN="40" AND P_ATK >=3

 

13.SQL command - WHERE

 

WHERE clause is used to collect the records from the table based on some condition specified by the where clause. More than one condition can be added to the where clause by using various logical expressions like AND, OR, < ( less than ), greater than (> ) etc. Logical expressions plays important role in returning the desire records. Let us start with some examples.

 

for example we want to see all heavy armors

 

SELECT * FROM armor WHERE armor_type="heavy"

 

now for example we want to see all heavy armors but only s grades.

 

SELECT * FROM armor WHERE armor_type="heavy" AND crystal_type="s"

 

if you want to see armors thats p.def is more then 300

 

SELECT * FROM armor WHERE p_def > 300

 

if you want to see armor thats p.def is between 200 and 300

 

SELECT * FROM armor WHERE p_def between 200 and 300

 

if you want to see armors thats name contains "imperial"

 

SELECT * FROM armor WHERE name LIKE '%Imperial%'

 

So with this guide is finish. but i will update it with more commands.

 

credits to me

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • hello everyone! I am wanting to save the files (Ini. - Data - ) of the EP5 Client: Salvation... But they generate the error "corrupt files"... I tried several versions of L2FileEditor without good results. I need help! Thank you!
    • Opening December 6th at 19:00 (GMT +3)! Open Beta Test from November 30th!   https://l2soe.com/   🌟 Introducing L2 Saga of Eternia: A Revolution in Lineage 2 High Five! 🌟   Dear Lineage 2 enthusiasts, Prepare to witness the future of private servers! L2 Saga of Eternia is not just another High Five project—it’s a game-changing experience designed to compete with the giants of the Lineage 2 private server scene. Built for the community, by the community, we’re here to raise the bar in quality, innovation, and longevity. What Sets Us Apart? 💎 No Wipes, Ever Say goodbye to the fear of losing your progress. Our server is built to last and will never close. Stability and consistency are our promises to you. ⚔️ Weekly New Content Our dedicated development team ensures fresh challenges, events, and updates every week. From custom quests to exclusive features, there will always be something exciting to explore. 💰 No Pay-to-Win Skill and strategy matter most here. Enjoy a balanced gameplay environment where your achievements come from effort, not your wallet. 🌍 A Massive Community With 2000+ players expected, join a vibrant and active community of like-minded adventurers ready to conquer the world of Aden. 🏆 Fair and Competitive Gameplay Our systems are designed to promote healthy competition while avoiding abusive mechanics and exploits. 🔧 Professional Development From advanced bug fixes to carefully curated content, we pride ourselves on smooth performance, no lag, and unparalleled server quality. Key Features Chronicle: High Five with unique interface Rate: Dynamic x10 rates Class Balance: Carefully fine-tuned for a fair experience PvP Focused: PvP Ranking & aura display effect for 3 Top PvPers every week Custom Events: Seasonal and permanent events to keep you engaged Additional Features:   Custom Endgame Content: Introduce unique dungeons, raids, or zones unavailable in other servers. Player-Driven Economy: Implement a strong market system and avoid overinflated drops or rewards. Epic Siege Battles: Announce special large-scale sieges and PvP events. Incentives for Streamers and Clans: Attract influencers and big clans to boost server publicity. Roadmap Transparency: Share a public roadmap of planned updates to build trust and excitemen   Here you can read all the features: https://l2soe.com/features   Video preview: Join the Revolution! This is your chance to be part of something legendary. L2 Saga of Eternia is not just a server; it’s a movement to redefine what Lineage 2 can be. Whether you’re a seasoned veteran or a newcomer to the world of Aden, we invite you to experience Lineage 2 at its finest.   Official Launch Date: December 6th 2024 Website: https://l2soe.com/ Facebook: https://www.facebook.com/l2soe Discord: https://discord.com/invite/l2eternia   Let’s build the ultimate Lineage 2 experience together. See you in-game! 🎮
    • That's like a tutorial on how to run l2 on MacOS Xd but good job for the investigation. 
    • small update: dc robe set sold   wts adena 1kk = 1.5$ 
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hood-services https://campsite.bio/utchihaamkt
  • Topics

×
×
  • Create New...