- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Can we skip a column name while inserting values in MySQL?
Yes, we can do that. Let us first create a table −
mysql> create table DemoTable -> ( -> StudentName varchar(100), -> StudentAge int -> ); Query OK, 0 rows affected (0.72 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable(StudentAge) values(23); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable(StudentName) values('John'); Query OK, 1 row affected (0.21 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output. NULL will get inserted for the skipped column values −
+-------------+------------+ | StudentName | StudentAge | +-------------+------------+ | NULL | 23 | | John | NULL | +-------------+------------+ 2 rows in set (0.00 sec)
- Related Articles
- Can we skip column when inserting into MySQL?
- Can we use INTERVAL keyword while inserting date records in a MySQL table?
- Can we insert values without mentioning the column name in MySQL?
- Set particular value of column without using update and while inserting values in MySQL
- Inserting multiple parameter values into a single column with MySQL?
- Update the date and time values while inserting them in MySQL
- Can we use MySQL keyword as alias name for a column?
- Set conditions while adding column values in MySQL?
- In MySQL, how can I insert date and time automatically while inserting NULL values to the other columns?
- Why can't we use column name “desc” in MySQL?
- Format date while inserting records in MySQL
- Can we use reserved word ‘index’ as MySQL column name?
- How can we insert current date and time automatically on inserting values in other columns in MySQL?
- How can we count a number of unique values in a column in MySQL table?
- How can we use MySQL self-computed output from any expression, function etc. for inserting values in a row?

Advertisements