currently learning from a textbook, still very new. I'm trying to delete this row from my table called classics, however, when I try to it won't let me.
--------------------- ------------------------------ ------------ ------ ---------
| author | title | type | year | ISBN |
--------------------- ------------------------------ ------------ ------ ---------
| Mark Tawin | The Adventures of Tom Sawyer | Fiction | 1876 | 978159 |
| JANE AUSTEN | PRIDE AND PREJIDUCE | FICTION | 1811 | 978058 |
| Mark Twain | Adventures of Tom Sawyer | Fiction | 1876 | 978159 |
| Jane Austen | Pride and Prejudice | Fiction | 1811 | 978058 |
| Charles Darwin | The Origin of Species | Nonfiction | 1856 | 978051 |
| Charles Dickens | The Old Curiosity Shop | Fiction | 1841 | 9780099 |
| William Shakespeare | Romeo and Juliet | Play | 1594 | 9780192 |
--------------------- ------------------------------ ------------ ------ ---------
This is the table currently, I'm trying to drop it using
ALTER TABLE classics DROP COLUMN `Mark Tawin`;
I've tried many variations of this as well, but it just doesn't seem to be working. Here's the table description if it helps.
-------- -------------- ------ ----- --------- -------
| Field | Type | Null | Key | Default | Extra |
-------- -------------- ------ ----- --------- -------
| author | varchar(128) | YES | MUL | NULL | |
| title | varchar(128) | YES | MUL | NULL | |
| type | varchar(16) | YES | MUL | NULL | |
| year | char(4) | YES | MUL | NULL | |
| ISBN | char(13) | YES | | NULL | |
-------- -------------- ------ ----- --------- -------
5 rows in set (0.02 sec)
CodePudding user response:
DROP COLUMN
removes columns not rows. As I understand your requirement you ness a
delete from classics where author = `Mark Tawin`