select * from users;
select id,username,salary+200 from users;
select * from users;
select username from users where salary>800;
select username from users where salary>800 and salary<>1800.5;
select username form users where salary>800 or salary<>1800.5;
select id,username,salary+200 from users;
select * from users;
select username from users where salary>800;
select username from users where salary>800 and salary<>1800.5;
select username form users where salary>800 or salary<>1800.5;
2018-01-10
select id as 编号,username as 用户名,salary 工资 from users;
select distinct username as 用户名 from users;
select distinct username as 用户名 from users;
2018-01-10
select * from users;
col id heading 编号;
col username heading 用户名;
col salary heading 工资;
select * from users;
select username,salary from users;
col id heading 编号;
col username heading 用户名;
col salary heading 工资;
select * from users;
select username,salary from users;
2018-01-10
col username heading 用户名;
select * from users;
col username format a10;
select * from users;
col salary format 9999.9;
select * from users;
col salary format 999.9;
select * from users;
col salary format $9999.9;
select * from users;
col username clear;
col salary clear;
select * from users;
select * from users;
col username format a10;
select * from users;
col salary format 9999.9;
select * from users;
col salary format 999.9;
select * from users;
col salary format $9999.9;
select * from users;
col username clear;
col salary clear;
select * from users;
2018-01-10
desc salary
select constraint_name,constraint_type,status from user_constraints where table_name='USERINFO_C3';
alter table userinfo_c3 disable constraint ck_salay_new;
select constraint_name,constraint_type,status from user_constraints where table_name='USERINFO_C3';
select constraint_name,constraint_type,status from user_constraints where table_name='USERINFO_C3';
alter table userinfo_c3 disable constraint ck_salay_new;
select constraint_name,constraint_type,status from user_constraints where table_name='USERINFO_C3';
2018-01-09
create table userinfo_c3(id varchar2(10) primary key, username varchar2(20), salary number(5,0));
alter table userinfo_c3 add constraint ck_salary_new check(salary>0);
alter table userinfo_c3 add constraint ck_salary_new check(salary>0);
2018-01-09
create table userinfo_c1(id varchar2(10) primary key,username varchar2(20), salary number(5,0),constraint ck_salary chack(salary>0));
2018-01-09
create table userinfo_c(id varvhar2(10) primary key, username varchar2(20), salary number(5,0) check(salary>0));
insert into userinfo_c values(1,'aa,-50);
insert into userinfo_c values(1,'aa,-50);
2018-01-09
select constraint_name,constraint_type,status from user_constraints where table_name='USERINFO_U2';
alter table userinfo_u2 disable constraint un_username_new;
select constraint_name,constraint_type,status from user_constraints where table_name='USERINFO_U2';
alter table userinfo_u2 disable constraint un_username_new;
select constraint_name,constraint_type,status from user_constraints where table_name='USERINFO_U2';
2018-01-09
create table userinfo_u2(id varchar2(10) primary key,username varchar2(20));
alter table userinfo_u2 add constraint un_username_new unique(username);
alter table userinfo_u2 add constraint un_username_new unique(username);
2018-01-09
create table userinfo_u(id varchar2(10) primary key,username varchar2(20) unique,userpwd varchar2(20));
create table userinfo_u1(id varchar2(10) primary key,username varchar(20),userpwd varchar2(20) ,constrait un_username unique(username));
create table userinfo_u1(id varchar2(10) primary key,username varchar(20),userpwd varchar2(20) ,constrait un_username unique(username));
2018-01-09
alter table userinfo_f4 drop constraint fk_typeid_alter;
select constraint_name,constraint_type,status from user_constraints where table_name='USERINFO_F4';
select constraint_name,constraint_type,status from user_constraints where table_name='USERINFO_F4';
2018-01-09
select constraint_name,constraint_type,status from user_constraints where table_name='USERINFO_F4';
alter table userinfo_f4 fisable constraint fk_typeid_alter;
select constraint_name,constraint_type,status from user_constraints where table_name='USERINFO_F4';
alter table userinfo_f4 fisable constraint fk_typeid_alter;
select constraint_name,constraint_type,status from user_constraints where table_name='USERINFO_F4';
2018-01-09
create table userinfo_f4(id varchar2(10) primary key,username varchar2(20),typeid_new varchar2(10));
alter table userinfo_f4 add constraint fk_typeid_alter foreign key(typeid_new) references typeinfo(typeid);
alter table userinfo_f4 add constraint fk_typeid_alter foreign key(typeid_new) references typeinfo(typeid);
2018-01-09