[SQL] A Beginner's Guide menu

User Tag List

Results 1 to 2 of 2
  1. #1
    Dr. Livingstone's Avatar Member
    Reputation
    113
    Join Date
    Mar 2008
    Posts
    290
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [SQL] A Beginner's Guide

    SQL is a very simple language to pick up, at least for what we are going to be doing when it comes to emu database stuff. As you learn more you will notice that it is very fluid, you can really read what you are writing out. So here we go. Real quick though, I am expecting that you already have a database set up and are running some program to manage it. I am using MySQL, but you could also use many other programs, like HeidiSQL.

    1. Starting Our First Query
    Building a query is very simple. We will start with something quite simple. If you are using MySQL go to the database you are using. There should be a part that says "Queries". Right click and select "New Query". Now we will start by selecting something from the database. Start your new query with 'SELECT *FROM'. This is saying that you are selecting some bit of info from some location. After 'SELECT *FROM' put the table you want to search for the info in. For us we will use 'creature_names'. Your query should now look like this:
    Code:
    SELECT *FROM creature_names
    Now you know where you are getting your information from, now you just need to say what information you want. So after 'creature_names' put 'WHERE name = Ragnaros' This is saying you are selecting the info from creature_names where the name of the NPC is Ragnaros. Your query should look like this:
    Code:
    SELECT *FROM creature_names WHERE name = Ragnaros
    Congratulations. You have completed your first query! Press run and you will see the query in action.

    2. Updating Information In Your Database
    The next step with SQL is to update information. So lets say you made an NPC and you realize you put something in there wrong. You are going to want to change that without deleting the NPC from the database and creating it again right? Thats why you need to learn how to update your information. Now all update queries start with 'UPDATE'. Simple enough right? Now we need to specify what the information is that you want to update. Lets update Ragnaros' subname. We use the SET syntax to state what we are changing, and what we are changing it to. Now lets make his subname 'Our First Update'. So our query should look like this:
    Code:
    UPDATE creature_names SET subname = 'Our First Update'
    Now be very careful. If you run this query at this point it would make every single NPC have the subname of 'Our First Update', which I'm guessing you don't want. Now we need to specify where we want to make the subname 'Our First Update'. So we will use the WHERE syntax once more. We want Ragnaros to have the subname of 'Our First Update' so we will put
    Code:
    WHERE name = 'Ragnaros'
    This is because we want to change the subname where the name of the NPC is Ragnaros.
    Our SQL should now look like this:
    Code:
    UPDATE creature_names SET subname = 'Our First Update' WHERE name = 'Ragnaros'
    Run the query and now in-game you should see 'Our First Update' under Ragnaros' name. You will either need to reload the database in-game using GM commands or restart for this to take effect.

    More coming soon! I just want to eat before I finish the rest.

    [SQL] A Beginner's Guide
  2. #2
    Rhetoric's Avatar Member
    Reputation
    1
    Join Date
    Jan 2009
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bravo, Thank you man. I'm very green when it comes to running a server, but that little bit there just taught me a lot.

    I did- UPDATE npc_trainer SET spellcost = '0'

    Awsome thank you

Similar Threads

  1. A Beginner's Guide to Warhammer Lore
    By alg in forum MMO Exploits|Hacks
    Replies: 1
    Last Post: 08-22-2022, 03:39 AM
  2. Beginners LUA Guide From Nub to Expert [updating]
    By mager1794 in forum WoW EMU Guides & Tutorials
    Replies: 0
    Last Post: 06-19-2008, 03:17 AM
  3. Replies: 37
    Last Post: 11-30-2007, 08:31 AM
  4. Beginners MC Guide
    By Amedis in forum World of Warcraft Guides
    Replies: 7
    Last Post: 01-05-2007, 11:44 PM
All times are GMT -5. The time now is 07:38 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search