Mysql query delete row without primary key

Queries derived from a single table lacking a primary key or from more than one table are not editable; they are read-only.

how would I go about deleting table data if it doesn’t have a primary key? I don’t normally mess with any of the mysql/php stuff on the server… but the current guy that does is MIA… and I really need to delete an entry.

you can delete a single row as long as you have some way of specifying which row it is using values in one or more of its columns

for example, let’s say your table has an id column that is the primary key and a name column

103 fred
104 todd
105 biff
106 matt

you can delete a row by name…

  from daTable
 where name = 'Todd'

in other words, the table doesn’t need to have a primary key, and you can delete based on any value(s) you wish

so if I put that in would it delete the entire row?

or just that part of it? … cause I need to delete the entire row.


in mysql administration… I’m going to Catalogs -> schemata (whazah)

then I click on the table name forum_bans and goto Edit table data

now in the query box it says: SELECT * FROM whazah.forum_bans

if I wanted to delete row 168 which has the data:

banned_id banned_name bannedby_name
81101 user1 user2

…what would I put in the query box?

  from forum_bans
 where banned_id = 81101

you can only ever delete entire rows

alright it worked…

just for reference…
can you give me an example of how to do a query to edit a row as well?

like say I wanted to edit user1 to user5

update forum_bans
   set banned_name = 'user5'
 where banned_id = 81101

awesome… thanks!