0

I trying to delete an entry from a table in mysql the table is for publications This is the table.

CREATE TABLE publication(pub_id VARCHAR(4) NOT NUll,
                         price DECIMAL(3, 2) NOT NULL,
                         name VARCHAR(20) NOT NULL,
                         frequency INTEGER(10) NOT NULL,
                         PRIMARY KEY(pub_id) );

This is the table with added entries

enter image description here

The query i'm using is

Delete from publication where pub_id = P001;

I get an error "Unknown column 'P001' in where clause"

What am I doing wrong?

Alfabravo
  • 7,493
  • 6
  • 46
  • 82

2 Answers2

1

If you don't use quotes, it will try to find a column|other object named P001. Try

delete from publication where pub_id = 'P001';
Alfabravo
  • 7,493
  • 6
  • 46
  • 82
1

please check manual Mysql correct:

Delete from publication where pub_id = 'P001';

check the manual and sintaxis here

Diego Avila
  • 700
  • 7
  • 24