id name
1 a
2 b
3 c
1 a
2 b
3 c
以下的sql语句都以上面表mytable为准:
1、查询id=1,3记录的所有数据
复制代码 代码如下:
select * from mytable where id in(1,3)
2、删除id重复的数据,表中数据只剩下id=1,2,3的所有数据
复制代码 代码如下:
select * into # from mytable
truncate table mytable
insert table select distinct * from #
select * from table
drop table #
3、创建一个新表 films_recent ,它的值包含来自表films
复制代码 代码如下:
SELECT * INTO films_recent FROM films
最后
以上就是英俊画板最近收集整理的关于SQL 实用语句的全部内容,更多相关SQL内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复