Last answered:

16 Nov 2022

Posted on:

04 Sept 2021

2

Why did you not do not null, primary key and auto increment for customer id in the solution?

Why did you not do not null, primary key and auto increment for customer id in the solution?

8 answers ( 0 marked as helpful)
Instructor
Posted on:

05 Sept 2021

1

Hi Marcus!

Thanks for reaching out.

'customers' is a table in which we want to store information about the customers in a company. We need a unique identifier, and we choose that identifier to be their respective ID. Since the table will not only contain data about customers, we want every customer to have a unique ID, and thus it is intuitive that each new insertion should be assigned an ID different from the previous ones. In other words, we want the customer ID numbers to increment automatically on the insertion of each new record, and that's why we don't want these values to be null.

Hope this helps.
Best,
Martin

Posted on:

03 Jan 2022

0

Hi Martin,

I think I see what Marcus is suggesting.

In the official solution from '5_8_creating-a-table-solution.sql', the answer does not include any primary key or auto_increment.  Maybe the answer could also updated to include that as well as add an unsigned int since it doesn't make sense to have a negative customer id or a negative number of complaints.

All the best,
David

Instructor
Posted on:

03 Jan 2022

2

Hi David!

Thanks for reaching out.

Thank you very much for your clarification, I think I now can see the point Marcus was trying to make.

Indeed, at the solution of leecture 5.8 we present code that does not include auto_increment and primary key constraints for the customer_id field of the 'customers' table. We chose to do that for simplicity - in the next section (and next few lectures) we build up on this query and we will add these functionalities to the 'customers' table.

Hope this helps.
Kind regards,
Martin

Posted on:

04 Jan 2022

1

Hi Martin,

Thanks getting back to me with your answer, that makes a lot of sense!

I'm looking forward to watching your next lectures!

All the best,
David

Instructor
Posted on:

08 Jan 2022

2

Hi David!

Thank you very much for your reply!

Working on adding new content in the meantime as well!

Kind regards,
Martin

Posted on:

15 Nov 2022

0

CREATE TABLE customers                                                

(

    customer_id INT,

    first_name varchar(255),

    last_name varchar(255),

    email_address varchar(255),

    number_of_complaints int

);

Posted on:

15 Nov 2022

0

CREATE TABLE customers                                                

(

    customer_id INT,

    first_name varchar(255),

    last_name varchar(255),

    email_address varchar(255),

    number_of_complaints int

);

Instructor
Posted on:

16 Nov 2022

0

Hi Asmaa!

Great to have you in the course and thanks for reaching out!

What exactly the question is? Thank you.

Looking forward to your answer.
Best,
Tsvetelin

Submit an answer