• Post Reply Bookmark Topic Watch Topic
  • New Topic

What's the significance of having null as a column ouput all nulls in SQL?  RSS feed

 
Ranch Hand
Posts: 83
MySQL Database Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simple query

select column_name, null from table_name;

what is the use of null here ?
 
Bartender
Posts: 4568
9
  • X Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's going to put a column in the output containing all nulls.

Pretty pointless by itself, but there may be cases where it's useful in conjunction with some other constructions. For example:
INSERT INTO ....
SELECT column_name, null
...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!