should be defined as a PRIMARY KEY When creating the table in order for this query to be executed well ?
It's totally optional, primary keys are defined in order to have one or more columns to uniquely identify a row in a table. CREATE TABLE article ( id PRIMARY KEY ); // <--- angry face? xD In the table article, the column id will uniquely identify an article entry (row). Behind the scenes, a primary key constrain will make the column(s) UNIQUE and NOT NULL
All of this is optional, but the nice thing about it is: if you use these constraints, whenever you make a mistake (enter an article with an id value that already exists), the database server will throw an error
Read about it on Google, you'll find a lot of information regarding DELETE FROM 😶
It should work fine without it being defined as primary key, although ids are usually defined as such
thanks very much , thanks for all this clear explanation !!
Обсуждают сегодня