
Error Column count doesn't match value count at row 1 SOLVED in Mysql
Error Column count doesn't match value count at row 1 SOLVED in Mysql
How to solve Error Code: 1136. Column count doesn’t match value count at row 1 in mysql is shown
Content
0.36 -> hey everyone in this video I'll be showing you
how to solve the error column count doesn't match
6.12 -> value count at Row 1 in MySQL so I'll be showing
you two scenarios why this error is occurring
11.94 -> and the solution for it so let's get started so
the first scenario is a table of a column having
16.74 -> the default constraint I think that is when this
particular error occurs most times another one is
21.18 -> going to be the normal table having many number
of columns so first I will be showing you this
25.56 -> one so this is my table named my table over here
it has like two columns ID and attendance ATT and
31.8 -> this ATT column has a default constraint so when
I just try to insert value into my table so here
37.26 -> I can see let me just now cut this yeah so I'm
just trying to insert a value into my table and
43.2 -> I'm inserting only the ID value because att is by
default right default it gets assigned to 100 if
48.84 -> I don't insert a value but if I run it like I'll
be getting the same error the reason is because
54.3 -> here we aren't specifying what this particular
value 2 is going to go or which column this
60.24 -> particular value two needs to be inserted we are
not specifying that we are just giving randomly
64.92 -> one value so MySQL can't find for which particular
column this value 2 needs to go so for that after
71.52 -> the table name just put a bracket and here we
have to specify for which particular column
76.62 -> this value needs to go so I will just go with
ID and you should not put here att because ID
82.26 -> doesn't have a default value only att has default
so by this way I'm specifying that this 2 needs
88.08 -> to go for the ID column and not attendance
which has a default value so now if I run it
96.42 -> yeah I'll be getting a green Mark which means that
the value has now been inserted so if I just do
101.58 -> select * from my table and run this I'll be having
two and the default value 100 inside it yeah in
111.42 -> case if you are having so many values other than
this like you are having another column like that
116.64 -> you can just put a comma and add the column name
over here as well so that's your choice so this
122.34 -> is how you solve the first scenario and let me
just now undo it and remove this itself yeah
128.88 -> so my second scenario is going to be this
one so this is a table that I'm having over
134.28 -> here it is called as newtab and I will also
have an insert command over here yeah okay
141.72 -> yeah this is the second scenario I will just
try to insert some values insert into new tab
149.04 -> I will go with okay values never forget that one
comma two alright just I'm just trying to insert
156.84 -> two values I'm just neglecting the final column
and it doesn't even have a default constraint
161.94 -> so if I just now run it yeah I'll be getting the
same error so in case if you have like skipped the
168.72 -> insertion of a column the number of parameters
that you're trying to insert needs to be equal
173.52 -> to the number of columns present in a table and
this error can also occur if you have like missed
178.08 -> a comma between that or in case if you're having
a like a string and if you're just typing name and
184.08 -> if you have like missed a double quotes you need
to just check that so I think that's basically the
188.94 -> most of the times the mistake if you're missing
a comma or a double quotes in case of string so
193.98 -> if I just now go with a name like a so if I just
now run it it'll be getting inserted so these are
202.08 -> like I think the two scenarios if you're using
default specify the column name in bracket after
207.24 -> the table name this will solve the issue and I
hope you would have found this video useful I've
212.58 -> also done many other tutorials in MySQL queries
interview questions C C++ Java python node.js
218.88 -> react.js mongodb so do check other videos of
my channel subscribe me thanks for watching
Source: https://www.youtube.com/watch?v=WF4VQVxjG6c