Last answered:

30 Aug 2020

Posted on:

30 Aug 2020

0

Exercise SQL: Creating Customer table

Hi,

When creating the customer table, the answer was the following:

CREATE TABLE customers                         

(

   customer_id INT,

   first_name varchar(255),

   last_name varchar(255),

   email_address varchar(255),

   number_of_complaints int

);

My script included "primary key" after customer_id INT.

Also, I put "unsigned" after number_of_complaints int

Shouldn't the customer_id be a Primary Key and the number of complaints be unsigned since we can't have a negative number of complaints?

My script:

CREATE TABLE Customers
(
customer_id INT PRIMARY KEY,

first_name VARCHAR(255),

last_name VARCHAR(255),

email_address VARCHAR(255),

number_of_complaints INT unsigned

);

Thank you for taking the time to read my question.

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

30 Aug 2020

0
Hi Harold! Thanks for reaching out.
  1. You've taken the task a step ahead by specifying the primary key at this stage. Congratulations on that! Moreover, this complies with our tasks and the purpose of having the Customers table in general, therefore, this is addition of your works great.
  2. Yes, your intuition is absolutely correct. We've relied on simplicity to teach the syntax that has been relevant for the given video. However, your remark is spot on!
Hope this helps.
Best,
Martin

Submit an answer