Question:

MySQL Server 5.0 command line help needed?

by Guest62266  |  earlier

0 LIKES UnLike

I'm supposed to work with a MySQL database.

In the command prompt I log into the MySQL server 5.0 and enter this:

"mysql> show tables;"

"mysql>select * from devicestates;"

Then the 'devicestates' are displayed in a table(has 14 rows and 4 columns of information)

What I need to do is edit this table that has 14 entries.

So what are the commands I need to use to delete certain entries in the table?

How about amending the data of a certain entry?

 Tags:

   Report

3 ANSWERS


  1. delete from <table name> where <condition>;

    The condition can contain any like eid=100

    note if u not given the condition the total table will be deleted.

    cheers:)


  2. DELETE and UPDATE are the two keywords you will use to control that. You will use a WHERE statement to determine which one to work with. Say, you want to delete all records with Smith in the lastname Row of a table called People:

    DELETE  FROM People WHERE lastname='Smith'

    Or, you want to change the name to jones if it equals smith..

    UPDATE People SET lastname='Jones' WHERE lastname='Smith'

  3. So what are the commands I need to use to delete certain entries in the table?

    DELETE FROM Person WHERE LastName = 'Rasmussen'

    How about amending the data of a certain entry?

    UPDATE Person SET FirstName = 'Nina'

    WHERE LastName = 'Rasmussen'

    OR

    UPDATE Person

    SET Address = 'Stien 12', City = 'Stavanger'

    WHERE LastName = 'Rasmussen'

Question Stats

Latest activity: earlier.
This question has 3 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.