First time writing sql

I follow this tutorial and I am at the stage of creating tables, why do I have an failed error message: table ‘student’ already exist?

Thank you in advanced for taking the time :slight_smile:

CREATE TABLE student (
    student_id INT,
    name VARCHAR(20),
    major VARCHAR(20),
    PRIMARY KEY(student_id)
);

select * from student;

INSERT INTO student VALUES(1, 'Jack', 'Biology');

Hello Randell does this help? I just learned to reply this way instead of making screenshots. I hope you can help me out. Thanks in advanced!

Video link SQL tutorial - Full database course by Mike Dane :

Chapter Inserting data begins at 1:33:29

Felissa from the Netherlands

Can somebody explain why I am having this error at chapter ‘inserting data’:

Column count doesn’t match value count at row 1

I followed the tutorial minute by minute, and installed both PopSQL and MySQL.

Can someone help me? Thank you so much for the support!

Felissa from the Netherlands.

what’s your code? what’s the link to the course you are following?

link of the course:

chapter inserting data video: 1:33:03

I do see now it is not a screenshot but a picture. I hope you can see the code well enough.
I can still start my other computer and make screen shot as well?

Sorry I am very new to this…

I have no experience with SQL but for people to be able to help you should really post your code, as a link to your project or pasting in a post here

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

CREATE TABLE student (
    student_id INT,
    name VARCHAR(20),
    major VARCHAR(20),
    PRIMARY KEY(student_id)
);

select * from student;

INSERT INTO student VALUES(1, 'Jack', 'Biology');

Thanks this was very helpful, I learn every day something new :slight_smile:

Hello there,

I do not know what the issue is, but what catches my eye is this line:

Yes that line was an advice from RandellDawson from another post and another issue. He said I should try this, to eliminate the other failed issue:

Table ‘student’ already exists

CREATE TABLE student (
    student_id INT,
    name VARCHAR(20),
    major VARCHAR(20),
    PRIMARY KEY(student_id)
);

So that’s why I kept the select * from student;

Anyway even I without the select * from student; code I still get the same error:

Column count doesn’t match value count at row 1

CREATE TABLE student (
    student_id INT,
    name VARCHAR(20),
    major VARCHAR(20),
    PRIMARY KEY(student_id)
);

INSERT INTO student VALUES(1, 'Jack', 'Biology');

I hope I made my self clear enough?

Sincerely Felissa

If you only run the following code:

select * from student;

Do you get results?

If so, that tells me at some point, when you attempted to write your SQL statements (the CREATE TABLE student part), that you did successfully create the table.

Now, that the table is created, everytime you attempt to run the CREATE TABLE student statement again, you are going to get that error.

You can try deleting the table by using the following command and then running your full code again.

DROP TABLE student ;

Let me know if the above results in an error. Make sure to only run the above statement.

Yes, thank you very much. Now I can proceed with the tutorial :slight_smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.