Sql Select语句
我正在寻找丹佛市所有车牌以字母“ATV”开头的汽车 我的选择语句 是 我找不到任何记录。你能帮我吗?你可以试试使用Sql Select语句,sql,Sql,我正在寻找丹佛市所有车牌以字母“ATV”开头的汽车 我的选择语句 是 我找不到任何记录。你能帮我吗?你可以试试使用 Select * from coloradodmv where licenseplate LIKE 'ATV%' Select * From coloradodmv Where licenseplate Like 'ATV%'; 我们已经回答了这个问题,但只是想澄清它是如何工作的: create table #plates (plateNo nvarchar(10)) in
Select * from coloradodmv where licenseplate LIKE 'ATV%'
Select *
From coloradodmv
Where licenseplate
Like 'ATV%';
我们已经回答了这个问题,但只是想澄清它是如何工作的:
create table #plates (plateNo nvarchar(10))
insert into #plates
values ('ATV1234'),
('BGZ1234'),
('ATV12345'),
('ATV123')
-- % represents 0 or more chars
select * from #plates where plateNo like 'ATV%'
--result
plateNo
ATV1234
ATV12345
ATV123
-- _ represents 1 char, __ respresents 2 chards and so on
select * from #plates where plateNo like 'ATV____'
--result
plateNo
ATV1234
重要提示:对于%和u,必须使用LIKE,否则不能使用=
例如:
-没有结果返回 请看接线员。选择*来自coloradodmv,其中许可证为“ATV%”选择*来自plateNo,例如“ATV%”欢迎来到hudson1995的Stack Overflow。我想您可能需要包含一个占位符变量?此外,您可能希望为@rbock的评论提供属性
create table #plates (plateNo nvarchar(10))
insert into #plates
values ('ATV1234'),
('BGZ1234'),
('ATV12345'),
('ATV123')
-- % represents 0 or more chars
select * from #plates where plateNo like 'ATV%'
--result
plateNo
ATV1234
ATV12345
ATV123
-- _ represents 1 char, __ respresents 2 chards and so on
select * from #plates where plateNo like 'ATV____'
--result
plateNo
ATV1234
select * from #plates where plateNo = 'ATV%'