Похожие чаты

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 ответов

8 просмотров

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 !!

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

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

читать файл максимально быстро? странный вопрос))
zamtmn
53
Посоветуйте пожалуйста аудио плеер для библиотеки mp3- FLAC на компьютере. На Винде пользовался Aimp, в том числе для конвертации. Много нужных команд было прямо в контекст...
Виктор Кузнецов
31
How Much Btc Falling Down ?
Suriya
22
Приветствуем всех! Устали без проектов? Если вы программист и хотите получать стабильные заказы, компания Elif предлагает вам недельный курс по поиску проектов и их ведению. ...
Elif
1
Hi guys ! Anvil is out ! Time for me to stake on capacity. Does someone has a clear tutorial ? I’m thinking about buying a ledger. Is that really possible to stake directl...
Mister Grega
14
Is someone using mymonero? What can you say about the wallet?
warrenique
16
It is definitely an interesting conversation. Breaking up the users into 2 personas: 1. Someone who wants to use the products (I want “x” pegged stablecoin that provides safe...
Bueno Pues
10
А чего сейчас в моде вместо Error для эксепшенов? А то я тут внезапно узрел что он не рекомендуется :) У Try::Tiny какой-то совершенно ужасный синтаксис если надо конкретные э...
Denis F
17
Ajeeb aadmi hai, isko padhna nahi aata kya?
Jay Bansal
43
Привет. Сразу скажу, что на C/C++/Rust я не пишу, но тем не менее возникла потребность дебага C/C++/Rust кода. Суть: есть серверное приложение, которое периодически ведёт себ...
ninekeem 🐳
4
Карта сайта