三級考試數據庫:SQL的基礎實例
1.-在數據庫中,一些數據,爲了方便起見,一些字母被替換爲
-例如,I在IO0011中被替換爲1,O被替換爲0
useaa
go
創建表卡
(
id int not null主鍵,
password varchar(10)
)值(1,' ooi 22 I ')
insert into card(id,password)
select o 300 ii 2 '
Select * from card 1
Result:
1 oo 22 I
2 o 100 ii 23
3 o 10 ii 24
4 oo 0 I 1 I 25
5 6 OS 0 I 1 I 2
Select replace(' o100 ii 2 ',' I ',' 1 '),' o ',' 0 '
Select replace(replace(password,' I ',' 1 ',' 1 '),' replace 。。對-
create table px
(id int主鍵,
shuju varchar(20)
)
insert into px(id,shuju)
select 1,' 13-1'union
select 2,' 13-4'union
select 3,' 13-114'union
select 4,' 13-2'union
select charindex ('-',' 113-1 ')-左側數據
select left ( Shuju)-1)作爲來自px的左側數據
select right ('113-1 ',len ('113-1')-charindex ('-',' 113-1 ')-right data
select right(Shuju,)Shuju))作爲來自PX的右側數據
select charindex ('-',' 13-1')
0條評論