Похожие чаты

Hello is product_id here : DELETE FROM products WHERE product_id=1

should be defined as a PRIMARY KEY When creating the table in order for this query to be executed well ?

6 ответов

19 просмотров

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

Edwing123
It's totally optional, primary keys are defined in...

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

𝘼𝙗𝙙𝙤-🧢 Автор вопроса
Edwing123
All of this is optional, but the nice thing about ...

thanks very much , thanks for all this clear explanation !!

Похожие вопросы

Обсуждают сегодня

а через ESC-код ?
Alexey Kulakov
29
30500 за редактор? )
Владимир
47
Чёт не понял, я ж правильной функцией воспользовался чтобы вывести отладочную информацию? но что-то она не ловится
notme
18
У меня есть функция где происходит это: write_bit(buffer, 1); write_bit(buffer, 0); write_bit(buffer, 1); write_bit(buffer, 1); write_bit(buffer, 1); w...
~
13
any reference of this implementation?
BitBuddha
29
Ⓐrtto, [4/23/24 7:02 PM] Please explain more fully how it is not working exactly, and what are the steps you are taking, and what error messages come or what happens. Ⓐrtto, ...
Ezza Kezza
2
sounds like people have lost their kaspa on tradeogre... does this mean tradeogre not trustworthy?
Ezza Kezza
15
Страшнейшая правда про списки ЦБ. С первых дней жизни P2P сферы, молодые человеки, начитавшись законодательной базы и "внутренних" документов, решили, что им противостоит сер...
Foxcool
3
Недавно Google Project Zero нашёл багу в SQLite с помощью LLM, о чём достаточно было шумно в определённых интернетах, которые сопровождались рассказами, что скоро всех "ибешни...
Alex Sherbakov
5
So much speculation in the last week. So much volatility in price. This is because Hedera has a GC that isn't using the network it's governing. Why aren't people asking why a...
Summit Seeker R
9
Карта сайта