Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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:

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...