Click to See Complete Forum and Search --> : example needed for what to type for the UPDATE query in the SQL language pls help me


Heavy Metal
11-13-2005, 08:22 PM
i would like for someone to give me an example of what i would type for the UPDATE query in the SQL language i have the 5.0 version and what it tells me in the manual is kind of confusing to me so if i could please get an example for that
please and thank you sooo much if you help me

NogDog
11-13-2005, 10:21 PM
Typically, something like:

UPDATE `table_name` SET `col_1`='value 1', `col_2`='value 2', `col_3`='value 3'
WHERE `key_column`='some value';

(Please note difference between ` and ' quotes.)

Heavy Metal
11-13-2005, 11:20 PM
Typically, something like:

UPDATE `table_name` SET `col_1`='value 1', `col_2`='value 2', `col_3`='value 3'
WHERE `key_column`='some value';

(Please note difference between ` and ' quotes.)
ok but what is the where thing all about i mean i dont understand what it is used for

NogDog
11-13-2005, 11:26 PM
It means to only update the row(s) in which that column has that value. For instance, if you wanted to update the password for user nogdog:

UPDATE `users` SET `password`='abcdefgh' WHERE `login_name`='nogdog';

Heavy Metal
11-13-2005, 11:44 PM
ok thanks so much dude i tryed it and it worked perfectly but is it possible to change the column names now?

NogDog
11-14-2005, 04:36 AM
ok thanks so much dude i tryed it and it worked perfectly but is it possible to change the column names now?
Sure, you set the table names and column names to whatever the applicable names are for the database you are working with.

Heavy Metal
11-14-2005, 08:20 AM
Sure, you set the table names and column names to whatever the applicable names are for the database you are working with.
ok could you please break that down into dumb person speak for me

NogDog
11-14-2005, 01:10 PM
Have you created a database that you want to use?

Each database consists of one or more tables. Each table consists of one or more columns (also called "fields" sometimes) that define the data to be stored in each row. Each table is then populated with rows of data, broken down into the defined columns.

In order to read or manipulate that data, you need to specify the table name you want to interact with, and the column names you want to read/insert/update. The specific names are whatever names you choose to use when you create the table definition.

If this is still all mumbo-jumbo to you, then my best suggestion would be to get hold of an introductory book on database design and use and/or to take a class on it at your local community college or such.

Heavy Metal
11-14-2005, 04:44 PM
yeah i think i get it but that whole "take a class on it at your local community college" option wouldn't work cause im kinda thirteen and i doubt they let thirteen year olds into college

Heavy Metal
11-14-2005, 04:44 PM
yeah i think i get it but that whole "take a class on it at your local community college" option wouldn't work cause im kinda thirteen and i doubt they let thirteen year olds into college

NogDog
11-14-2005, 05:23 PM
yeah i think i get it but that whole "take a class on it at your local community college" option wouldn't work cause im kinda thirteen and i doubt they let thirteen year olds into college
LOL - OK, maybe that's not a valid option quite yet.

Here are a few online tutorials I've located, though I'll not vouch for the quality of any:

http://www.htmlgoodies.com/primers/database/
http://www.w3schools.com/sql/default.asp (warning: has pop-up ads)
http://sqlcourse.com/

Heavy Metal
11-14-2005, 07:35 PM
ok thanks that helps alot but now i need help with learning how to delete a table i dont think it is the DELETE command but i cant remember which one it is so i am currently consulting my manuel on that

EDIT: ok i got it, it was the drop table command that i was looking for

P.S. i am really starting to get the hang of this syntax YAY ME!!!!!