InterviewSolution
Saved Bookmarks
| 1. |
How to create empty tables with the same structure as another table? |
|
Answer» Creating empty TABLES with the same structure can be done smartly by fetching the records of ONE table into a new table using the INTO operator while fixing a WHERE CLAUSE to be false for all records. Hence, SQL prepares the new table with a duplicate structure to accept the fetched records but since no records GET fetched due to the WHERE clause in action, nothing is inserted into the new table. SELECT * INTO Students_copyFROM Students WHERE 1 = 2; |
|