SQL 101: Understanding the Basics menu

User Tag List

Results 1 to 3 of 3
  1. #1
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL 101: Understanding the Basics

    I know this should probably go in the section for SQL but it applys most here and it will help more people here. It is focused more as applys to MySQL and the emulation structure.

    But anyways, knowing SQL and how it works is one of the keys to being successful in emulation as well as compiling Ascent or compiling a DLL. Anyways, here we go!

    What is SQL?
    Dictionary.com defines it as: An industry-standard language for creating, updating and, querying relational database management systems. Thats about it, and it stands for Structured Query Language (SQL).

    The SELECT Command
    We use the SELECT command to find information we need. So heres the syntax:
    Code:
    SELECT FROM `tablename` WHERE `columnname` = value;


    Heres an example:
    Code:
    SELECT FROM `creature_names` WHERE `entryid`= 1;


    Take note that I'm using `` (Next to 1 on keyboard) to enclose my table and column names. You should use either '' (apostrephes) and sometimes "" (quotations) to outline text. Such as:
    SELECT FROM `creature_names` WHERE `name` = 'Example';

    For numeral (number) values, do not use any quotations or characteristics to enclose it. See the SELECT example.

    The UPDATE Command
    This command is used to update exsisting information, meaning, there must already be an entry in the database for the entry your updating, and not a new entry. You don't need the syntax examples from now on just normal examples.
    Code:
    UPDATE `creature_names` SET `flags1` = 4 WHERE (`entry` = 1);



    The DELETE Command
    This command is used to delete certain entries. You can use it to delete databases and rows also but I'll just show you entries and rows.
    Code:
    DELETE FROM `creature_names` WHERE `name` = 'Example';
    Code:
    DELETE FROM `creature_spawns`;



    The AND/OR Command
    In the AND command the things being binded by the "AND" both have to hold true for a result to be shown (Have to show both things after WHERE)
    Example:
    Code:
    SELECT FROM `creature_names` WHERE `name` = 'Example' AND `subname` = 'Example';


    In the OR command only one of the things has to be true (Have to show one thing after WHERE)
    Example:
    Code:
    SELECT FROM `creature_names` WHERE `name` ='Example' OR `subname` = 'Example';



    So in the first example the name AND subname have to be true to show a result. In the second example only the name OR subname has to be true to show a result.


    The BETWEEN Command
    This command finds all entries between two vaulues.
    Example:
    Code:
    SELECT * FROM `creature_names` WHERE `name` BETWEEN 1 AND 100;


    Note the * between SELECT and FROM. Also note that the numeric values don't have marking around them.


    You did it! You now know the basic syntax of SQL! Now you can move on the the advanced tutorial (yet to be written).


    Thanks and Enjoy!


    -SectorSeven

    SQL 101: Understanding the Basics
  2. #2
    Maisteri's Avatar That spoiler guy
    Reputation
    441
    Join Date
    Aug 2007
    Posts
    894
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This guide was easy to read and helped me alot.

    Good bye for deleting/editing NPC's with mouse and keyboard 1 by 1 ;P

    +Rep for you

  3. #3
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Appreciate it!

Similar Threads

  1. Understanding The basics of Lua Locals!
    By Dibes in forum WoW EMU Guides & Tutorials
    Replies: 1
    Last Post: 07-12-2009, 12:08 AM
  2. How to understand Lua - The Basics
    By Nymphx in forum WoW EMU Guides & Tutorials
    Replies: 4
    Last Post: 06-02-2009, 03:15 PM
  3. the basics~
    By Sick Blood in forum WoW ME Questions and Requests
    Replies: 4
    Last Post: 01-05-2008, 10:41 PM
  4. Learning the Basics
    By Nkapocal in forum Community Chat
    Replies: 0
    Last Post: 12-13-2007, 09:14 PM
  5. Tanking For Dummies Part 1: The Basics
    By Krazzee in forum World of Warcraft Guides
    Replies: 1
    Last Post: 06-14-2006, 07:41 AM
All times are GMT -5. The time now is 09:15 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