sql语句with as 和with(nolock)
时间:2022-03-14 23:49
当with和as一起用时,表示定义一个SQL字句
例:
with
sonword as
(
select * from person
)
select * from student
where name in (select name from sonword)
相当于
select * from student
where name in (select name from person)
with(nolock)
一般用于select语句中,可以读取被事务锁定的数据
能提升sql的查询性能,解决阻塞死锁,但有可能造成脏读等数据问题