SQL Tutorial - Basic

Iamcoolz Jul 29, 2014

  1. Iamcoolz

    Iamcoolz Forum Administrator Staff Member XPG Administrator
    235/282

    Joined:
    Mar 30, 2012
    Messages:
    1,231
    Likes Received:
    509
    Trophy Points:
    205
    Gender:
    Male
    Location:
    XPG
    Console:
    Xbox One
    Moderators feel free to move this! I just didn't see a specific place for this. :p

    I work a lot with SQL and know commands that makes my life a hell of a lot easier! For those of you who are interested in learning a rather simple language, or who are planning on going into database programs in college or anything like queries you will be fine. Microsoft suite has a program commonly used in most businesses for databases, and it is called "Access" and the commands are rather similar to this.

    When you apply for jobs, SQL experience looks extremely good on you and will help you a lot if you plan to do like I said above, database jobs.

    *Select Command*

    This command is probably one of the most used commands, as this is a search function used for databases and allows you to pull customer information with a simple line.

    select * from CUSTOMER where name = 'John'
    This will select the names that are John, in the CUSTOMER table in your database. Now let's say you just can't quite think of the exact name but know a couple of characters!

    select * from CUSTOMER where name like = '%Joh%'
    This will select anything in the CUSTOMER table, and in the column name, that has anything similar to Joh.

    *Insert Command*

    This is another command that I use quite a bit, and this would be to insert customer information. Now a days, this is completely obsolete as PHP has allowed a user to fill out a form, and then PHP generates the SQL script for you, but if you don't have a website you can easily make your own by doing something like this.

    insert into CUSTOMER values ('Value1' , 'Value2', 'Value3')
    This would insert into the table CUSTOMER whatever you put into those values, so let's say you wanted to enter his first name, last name, and then zip code.

    insert into CUSTOMER values ('John', 'Doe', '65721')
    and that would insert John in the first column, Doe in the second, 65721 in the third.

    *Update Command*

    Now let's say the customer called and you need to update the information.

    update CUSTOMER set 1stColumn = 'Johnny', 2ndColumn = 'Dough' where 1stColumn = 'John'
    This would update the user information in a sense, however, your database may be more complex and it may require you to be more specific after the WHERE command. You could do something like this:

    update CUSTOMER set 1stColumn = 'Johnny', 2ndColumn = 'Dough' where 1stColumn = 'John', 2ndColumn = 'Doe'
    *Delete Command*

    Delete command is one my most used outside of select, probably second. Let's say John Doe wants his information removes from your database, simple as pie.

    delete * from CUSTOMER where 1stColumn ='John' , 2ndColumn = 'Doe', 3rdColumn = '65721'
    and booya!

    These are the 4 major commands for SQL queries.
     
  2. Skeleton

    Skeleton Newbie
    0/47

    Joined:
    Apr 15, 2014
    Messages:
    228
    Likes Received:
    108
    Trophy Points:
    0
    Gender:
    Male
    Location:
    United Kingdom
    Console:
    Xbox
    Nice tutorial, very helpful for a lot of people :) thanks for this.
     
  3. reloadmydeagle

    reloadmydeagle I LoVe GoldZ Lifetime Gold XPG Retired Staff
    135/188

    Joined:
    Oct 30, 2013
    Messages:
    1,609
    Likes Received:
    656
    Trophy Points:
    135
    Gender:
    Male
    Location:
    Texas
    Console:
    Xbox One
    Great tutorial, good for anyone interested in creating any type of website ;)
    Thanks for this SQL was the only internet language I don't know :p
     
  4. Iamcoolz

    Iamcoolz Forum Administrator Staff Member XPG Administrator
    205/282

    Joined:
    Mar 30, 2012
    Messages:
    1,231
    Likes Received:
    509
    Trophy Points:
    205
    Gender:
    Male
    Location:
    XPG
    Console:
    Xbox One
    SQL isn't necessarily an internet language. It's a data based language, PHP, HTML, would be your more website based languages.
     
  5. begallegal1

    begallegal1 Medicine Man Lifetime Gold TeamXPG
    235/282

    Joined:
    Oct 31, 2011
    Messages:
    3,694
    Likes Received:
    3,129
    Trophy Points:
    235
    Gender:
    Male
    Location:
    In a Field of Green
    Console:
    Xbox
    thanks for this coolz, I'm just finishing a java course that for the last few weeks has been dealing with servlets, jsp, sql and their interaction together. Let me tell you compared to most bits and pieces of info I found trying to do the assignments this is a great and straight forward tutorial , A++ content right here ;)

    ( and yes I know kinda silly for an old man like me to go back to school, but it keeps me on my toes and learning :p )
     
  6. Iamcoolz

    Iamcoolz Forum Administrator Staff Member XPG Administrator
    205/282

    Joined:
    Mar 30, 2012
    Messages:
    1,231
    Likes Received:
    509
    Trophy Points:
    205
    Gender:
    Male
    Location:
    XPG
    Console:
    Xbox One
    Java, is a wonderful language. You're never too old to go to college! In-fact, I respect those older people who try to take part in the generation of technology rather than reject it and say its stupid. :p
     

Share This Page

Close