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);

КОМЕНТАРІ • 18

  • @BroCodez
    @BroCodez  Рік тому +8

    - 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);

  • @RGGBMGO
    @RGGBMGO Рік тому +6

    First, heart?Btw ur coding videos are the best, you help and educate so many 😁

  • @MissP3224
    @MissP3224 День тому

    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?

  • @MohammadMomin
    @MohammadMomin 9 місяців тому +4

    John Smith Lol😂😂

  • @princeakinolaoluwagbemigag1750

    Thank you for this video big bro.
    Pls what is the difference between the primary key and the unique constraint?

    • @farisabufarha531
      @farisabufarha531 Рік тому +1

      unique constraint could be null

    • @arihantgupta4480
      @arihantgupta4480 5 днів тому

      Also when using primary key, the data is inserted into the table as sorted, based on the value of the primary key column.

  • @farhangmdc
    @farhangmdc Рік тому +4

    Good Video , How to get Primary Key Auto Generated ? 🔑🔑

  • @themachina7713
    @themachina7713 Рік тому +3

    why does my sql table add a null row after i added a PRIMARY KEY constraint?

  • @luistroyparaiso5853
    @luistroyparaiso5853 Рік тому +5

    How do you make primary keys like "AA-0001"??

  • @crackrokmccaib
    @crackrokmccaib Рік тому +2

    For whatever reason, I thought you were Canadian until now.

  • @emanuelitalo5073
    @emanuelitalo5073 Рік тому +4

    make subtitles for portuguese br please😳😳😳

  • @kusumaparimi2929
    @kusumaparimi2929 5 місяців тому +1

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