1.显示雇员姓名 首字母是大些字母的所有雇员名字
2.显示所有雇员名字 并且把名字中A改为a。。。
新手求助
11 个解决方案
#1
雇员姓名=GZXM
雇员名字=GYMZ
1、select * from test where regexp_like(GZXM,'^[A-Z].*')
2、select replace(GYMZ,'A','a') from test
雇员名字=GYMZ
1、select * from test where regexp_like(GZXM,'^[A-Z].*')
2、select replace(GYMZ,'A','a') from test
#2
select * from scott.emp where regexp_like(ename,'^[A-Z].*');
select replace(ename,'A','a') from scott.emp;
select replace(ename,'A','a') from scott.emp;
#3
select 雇员姓名 from 雇员表 where ascii(substr(雇员姓名,1,1))>=65 and ascii(substr(雇员姓名,1,1))<90
select replace(雇员姓名,'A','a') from 雇员表
#4
select * from emp where Upper(substr(ename,0,1))=substr(ename,0,1) ;
#5
SELECT LOWER(EMPLOYEE_NAME) FROM EMPLOYEE
#6
select * from test where regexp_like(雇主姓名,'^[A-Z].*');
select replace(雇主名字,'A','a') from test;
#7
select * from emp where regexp_like(GYXM,'^[A-Z].*')
select regexp_replace(GYXM,'A','a',1,0,‘c’) from emp
select regexp_replace(GYXM,'A','a',1,0,‘c’) from emp
#8
select * from emp where regexp_like(ename,'^[A-Z].*');
select replace(ename,'A','a') from emp;
#9
留个脚印,这个貌似很少用到,不过很有用
#10
创建并插入数据
==========================================
prompt PL/SQL Developer import file
prompt Created on 2017年7月3日 by admin
set feedback off
set define off
prompt Creating T_TEST_USER...
create table T_TEST_USER
(
id VARCHAR2(20),
name VARCHAR2(50)
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
prompt Loading T_TEST_USER...
insert into T_TEST_USER (id, name)
values ('1', 'Anm');
insert into T_TEST_USER (id, name)
values ('2', 'zad');
insert into T_TEST_USER (id, name)
values ('3', 'qwer');
commit;
prompt 3 records loaded
set feedback on
set define on
prompt Done.
测试
==========================================
select * from t_test_user t where regexp_like(t.name,'^[A-Z].*');
select replace(t.name,'A','a') from t_test_user t;
==========================================
prompt PL/SQL Developer import file
prompt Created on 2017年7月3日 by admin
set feedback off
set define off
prompt Creating T_TEST_USER...
create table T_TEST_USER
(
id VARCHAR2(20),
name VARCHAR2(50)
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
prompt Loading T_TEST_USER...
insert into T_TEST_USER (id, name)
values ('1', 'Anm');
insert into T_TEST_USER (id, name)
values ('2', 'zad');
insert into T_TEST_USER (id, name)
values ('3', 'qwer');
commit;
prompt 3 records loaded
set feedback on
set define on
prompt Done.
测试
==========================================
select * from t_test_user t where regexp_like(t.name,'^[A-Z].*');
select replace(t.name,'A','a') from t_test_user t;
#11
select * from test where regexp_like(GZXM,'^[A-Z].*')
select replace(ename,'A','a') from emp
select replace(ename,'A','a') from emp
#1
雇员姓名=GZXM
雇员名字=GYMZ
1、select * from test where regexp_like(GZXM,'^[A-Z].*')
2、select replace(GYMZ,'A','a') from test
雇员名字=GYMZ
1、select * from test where regexp_like(GZXM,'^[A-Z].*')
2、select replace(GYMZ,'A','a') from test
#2
select * from scott.emp where regexp_like(ename,'^[A-Z].*');
select replace(ename,'A','a') from scott.emp;
select replace(ename,'A','a') from scott.emp;
#3
select 雇员姓名 from 雇员表 where ascii(substr(雇员姓名,1,1))>=65 and ascii(substr(雇员姓名,1,1))<90
select replace(雇员姓名,'A','a') from 雇员表
#4
select * from emp where Upper(substr(ename,0,1))=substr(ename,0,1) ;
#5
SELECT LOWER(EMPLOYEE_NAME) FROM EMPLOYEE
#6
select * from test where regexp_like(雇主姓名,'^[A-Z].*');
select replace(雇主名字,'A','a') from test;
#7
select * from emp where regexp_like(GYXM,'^[A-Z].*')
select regexp_replace(GYXM,'A','a',1,0,‘c’) from emp
select regexp_replace(GYXM,'A','a',1,0,‘c’) from emp
#8
select * from emp where regexp_like(ename,'^[A-Z].*');
select replace(ename,'A','a') from emp;
#9
留个脚印,这个貌似很少用到,不过很有用
#10
创建并插入数据
==========================================
prompt PL/SQL Developer import file
prompt Created on 2017年7月3日 by admin
set feedback off
set define off
prompt Creating T_TEST_USER...
create table T_TEST_USER
(
id VARCHAR2(20),
name VARCHAR2(50)
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
prompt Loading T_TEST_USER...
insert into T_TEST_USER (id, name)
values ('1', 'Anm');
insert into T_TEST_USER (id, name)
values ('2', 'zad');
insert into T_TEST_USER (id, name)
values ('3', 'qwer');
commit;
prompt 3 records loaded
set feedback on
set define on
prompt Done.
测试
==========================================
select * from t_test_user t where regexp_like(t.name,'^[A-Z].*');
select replace(t.name,'A','a') from t_test_user t;
==========================================
prompt PL/SQL Developer import file
prompt Created on 2017年7月3日 by admin
set feedback off
set define off
prompt Creating T_TEST_USER...
create table T_TEST_USER
(
id VARCHAR2(20),
name VARCHAR2(50)
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
prompt Loading T_TEST_USER...
insert into T_TEST_USER (id, name)
values ('1', 'Anm');
insert into T_TEST_USER (id, name)
values ('2', 'zad');
insert into T_TEST_USER (id, name)
values ('3', 'qwer');
commit;
prompt 3 records loaded
set feedback on
set define on
prompt Done.
测试
==========================================
select * from t_test_user t where regexp_like(t.name,'^[A-Z].*');
select replace(t.name,'A','a') from t_test_user t;
#11
select * from test where regexp_like(GZXM,'^[A-Z].*')
select replace(ename,'A','a') from emp
select replace(ename,'A','a') from emp