How to use practical statements in SQL
What this article shares to you is about how to use the practical sentences in SQL. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
Id name 1 a 2 b 3 c 1 a 2 b 3 c 1 a 2 b 3 c below sql statements are above the table mytable: 1. Query all data recorded by id=1,3.
The code is as follows:
Select * from mytable where id in (1pr 3)
2. Delete the duplicate data of id, and only all the data of id=1,2,3 is left in the table.
The code is as follows:
Select * into # from mytable truncate table mytable insert table select distinct * from # select * from table drop table #
3. Create a new table films_recent whose value contains the value from the table films
The code is as follows:
SELECT * INTO films_recent FROM films
The above is how to use the practical sentences in SQL. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.