MySQL: PRIMARY KEYS are easy
Вставка
- Опубліковано 26 лип 2024
- #MySQL #tutorial #course
00:00:00 introduction
00:00:46 PRIMARY KEY with a new table
00:01:34 PRIMARY KEY with an existing table
00:02:11 examples
00:04:56 conclusion
- EXAMPLE 1 --
CREATE TABLE transactions (
transaction_id INT PRIMARY KEY,
amount DECIMAL(5, 2)
);
- EXAMPLE 2 --
ALTER TABLE transactions
ADD CONSTRAINT
PRIMARY KEY (transaction_id);
- EXAMPLE 1 --
CREATE TABLE transactions (
transaction_id INT PRIMARY KEY,
amount DECIMAL(5, 2)
);
- EXAMPLE 2 --
ALTER TABLE transactions
ADD CONSTRAINT
PRIMARY KEY (transaction_id);
First, heart?Btw ur coding videos are the best, you help and educate so many 😁
Love the channel name!
I'm here to try and understand why the null values in the last row if I specify the Primary key?
John Smith Lol😂😂
Thank you for this video big bro.
Pls what is the difference between the primary key and the unique constraint?
unique constraint could be null
Also when using primary key, the data is inserted into the table as sorted, based on the value of the primary key column.
Good Video , How to get Primary Key Auto Generated ? 🔑🔑
next video
Auto_increment
why does my sql table add a null row after i added a PRIMARY KEY constraint?
Got the same question
How do you make primary keys like "AA-0001"??
set the datatype to string
For whatever reason, I thought you were Canadian until now.
make subtitles for portuguese br please😳😳😳
create table transaction (
trans_id int,
amount decimal(10,2),
constraint pk_transaction primary key(trans_id, amount)
); we apply primary key for multiple columns using this query... but in this video said, only one primary key for each table??
true