Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in SQL by (6.1k points)
CREATE TABLE EMPL_DEMO AS SELECT * FROM employees WHERE 1=2;

I have seen this statement someplace on the internet but I couldn't understand the WHERE 1=2.

Can anyone please, explain this? 

1 Answer

0 votes
by (12.7k points)
edited by

This type of command is normally used to copy the structure of one table to the another. In this case, EMPL_DEMO will be having the same column structure of employees, except for the keys or constraints.

The 1=2 always evaluates to False which stops you from copying any of the rows.

Want to be a SQL expert? Come and join this SQL Certification course by Intellipaat.

If you want to know more about SQL, refer to the below SQL tutorial video that will help you out in a better way:

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.6k users

Browse Categories

...