- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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)
Advertisements