The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

Exercise SQL: Creating Customer table

Exercise SQL: Creating Customer table

0
Votes
1
Answer

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 Answer

365 Team
0
Votes

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

Thank you Martin!

3 weeks

You are very welcome!

3 weeks
×
Ready to Learn
Data Science?
50% OFF