select * from account ;
-- drop table parenttjj cascade constraints purge ;
drop table account cascade constraints purge ;
drop sequence s_account_id ;
alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss' ;
create table account(
id number(9) constraint account_id_pk primary key not null ,-- 账务账号ID
recommender_id number(9) constraint account_r_id_fk references account(id),-- 推荐人ID
constraint account_r_id_ck check(recommender_id <> id),
login_name varchar2(30) constraint account_login_name_uk unique ,-- 登录系统的用户名
login_passwd varchar2(8) not null ,-- 登录口令
status char(1) not null constraint account_status_ck check(status in ('0','1','2')),-- 0:开通;1:暂停;2:删除
create_date date default sysdate,-- 创建日期
pause_date date default null ,-- 暂停日期
close_date date default null,-- 删除日期
real_name varchar2(20) not null ,-- 客户姓名
idcard_no char(18) not null constraint account_idcard_no_uk unique,-- 身份证号码
birthdate date default null ,-- 出生日期
gender char(1) not null constraint account_gender_ck check(gender in ('0','1')) ,-- 性别 0:男 1:女
occupation varchar2(50) default null , -- 职业
telephone varchar2(15) not null ,-- 联系电话(座机或手机)
email varchar2(50) default null,-- 电子邮箱
mailaddress varchar2(120) default null ,-- 邮箱地址
zipcode char(6) default null,-- 邮编
qq varchar2(15) default null , -- QQ
last_login_time date default null,-- 最后一次登录时间
last_login_ip varchar2(15) default null -- 最后一次登录IP地址
) ;
create sequence s_account_id
start with 1001
increment by 1 ;
insert into account values(
s_account_id.nextval,null,'tjj1302','123456','0',sysdate,null,null,'tangjianjun','420115199001154714'
,'1990-01-15','0',null,'15102763027',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,null,'lc1302','123456','0',sysdate,null,null,'liancong','420115198901154714'
,'1989-05-20','0',null,'18271914072',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,null,'ylm1302','123456','0',sysdate,null,null,'yaoleiming','420115198901254714'
,'1988-04-11','0',null,'15102763526',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,null,'lyc1302','123456','0',sysdate,null,null,'liyinchuan','420115198905154714'
,'1962-03-19','0',null,'15629149126',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,null,'taiji001','256528','1','2008-03-15',null,null,'zhangsanfeng','410381194302256528'
,'1943-02-25','0',null,'13669351234',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,null,'sxl1302','123456','0',sysdate,null,null,'suxiaolin','420105198901154714'
,'1960-03-29','0',null,'15623601238',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,1001,'cr1302','123456','0',sysdate,null,null,'chenrong','420115199211304714'
,'1999-04-19','0',null,'15871455288',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,1002,'zj1302','123456','0',sysdate,null,null,'zhangjun','420115199002154714'
,'2011-04-10','0',null,'15102365254',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,1002,'wj1302','123456','0',sysdate,null,null,'wangjun','420115199001254714'
,'2010-03-15','0',null,'15262541254',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,null,'xl18z60','190613','1','2009-01-10',null,null,'guojing','330682196903190613'
,'1969-03-19','0',null,'13338924567',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,1010,'dgbf70','270429','1','2009-03-01',null,null,'huangrong','330902197108270429'
,'1971-08-27','0',null,'13637811357',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,null,'tjj1302_3','123456','0',sysdate,null,null,'tangjianjun_3','420115199001154717'
,'2012-05-14','0',null,'15102763030',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,null,'tjj1302_4','123456','0',sysdate,null,null,'tangjianjun_4','420115199001154718'
,'2013-01-01','0',null,'15102763031',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,null,'tjj1302_5','123456','0',sysdate,null,null,'tangjianjun_5','420115199001154719'
,'2001-05-18','0',null,'15102763032',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,1005,'mjjzh64','041115','1',sysdate,null,null,'zhangwuji','610121198906041115'
,'1989-06-04','0',null,'13572952468',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,null,'tjj1302_6','123456','0',sysdate,null,null,'tangjianjun_6','420115199001154729'
,'1899-03-18','0',null,'15102765002',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,null,'tjj1302_7','123456','0','2010-03-12',null,null,'tangjianjun_7','420115199001054719'
,'1907-05-10','0',null,'15102763122',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,1011,'jmdxj00','010322','1','2011-01-01',null,null,'guofurong','350581200201010322'
,'1820-01-01','0',null,'18617832562',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,1011,'ljxj90','310346','1','2012-02-01',null,null,'luwushuang','320211199307310346'
,'1993-07-31','0',null,'13186454984',null,null,null,null,null,null) ;
insert into account values(
s_account_id.nextval,null,'kxhxd20','012115','1','2012-02-20',null,null,'weixiaobao','321022200010012115'
,'2000-10-01','0',null,'13953410078',null,null,null,null,null,null) ;
-- alter table account modify mailaddress varchar2(120) ;
-- select * from (select rownum rn ,id,recommender_id,login_name,login_passwd ,status ,create_date
-- , pause_date,close_date, real_name, idcard_no,birthdate , gender ,occupation,telephone
-- , email,mailaddress ,zipcode ,qq,last_login_time,last_login_ip from account where rownum <= 5) where rn >= 1
-- update account set recommender_id = 1002,login_name='tjj1302',login_passwd='123456' ,status='1' ,create_date='2013-06-06 17:09:17'
-- , pause_date = null,close_date=null, real_name='tang', idcard_no='420115199001154714',birthdate ='1990-01-15' , gender='0' ,occupation =null ,telephone='15102763027'
-- , email=null,mailaddress=null ,zipcode=null ,qq='941677893',last_login_time=null,last_login_ip=null where id = 1001 ;
-- select * from account order by id;
commit ;
-- update account set status = '1' where id = 1002 ;
-- update account set occupation = '1' ;
-- update account set mailaddress = '北京市海淀区北三环中路甲18号中鼎大厦' ;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- 管理员表
drop table admin_info cascade constraints purge ;
drop sequence s_admininfo_id ;
create table ADMIN_INFO
(
id NUMBER(11) not null,
admincode VARCHAR2(30) not null,
password VARCHAR2(30) not null,
name VARCHAR2(30) not null,
telephone VARCHAR2(30),
email VARCHAR2(50),
enrolldate DATE not null
);
alter table ADMIN_INFO
add constraint ADMIN_INFO_ID_PK primary key (ID);
alter table admin_info add constraint admin_info_admincode_uk unique (admincode);
create sequence s_admininfo_id start with 1 increment by 1 ;
alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss' ;
insert into admin_info values(s_admininfo_id.nextval,'admin','admin','admin','13572451258','94131@qq.com',sysdate);
insert into admin_info values(s_admininfo_id.nextval,'root','root','root','510251625','5241@qq.com',sysdate);
insert into admin_info values(s_admininfo_id.nextval,'tarena','tarena','tarena','15125025124','52541@qq.com',sysdate);
insert into ADMIN_INFO (id, admincode, password, name, telephone, email, enrolldate) values (s_admininfo_id.nextval, 'tcr110', '111111', '管理员', '13111111111', '11@11.com', to_date('13-05-2013 08:20:20', 'dd-mm-yyyy hh24:mi:ss'));
select * from admin_info ;
commit;
-- 查询刚插入的数据的自增长值
-- select s_admininfo_id.currval from dual
select * from role ;
select * from admin_role ;
-- 分页查询管理员
-- select distinct id,admincode,password,name,telephone,email,enrolldate from
-- (select rownum rn,id,admincode,password,a.name,telephone,email,enrolldate
-- from admin_info a join (select * from admin_role
-- where role_id = 1 or 1=1) b on a.id = b.admin_id join (select * from role
-- where name='角色管理')c on b.role_id = c.id where rownum <= 5) where rn >=1;
-- 获取数据条数,用于获取分页的总页数
-- select count(distinct c.id) from admin_info c join (select * from (select * from admin_role where role_id = 1) a join (select * from role where name like '%角色%') b on a.role_id = b.id ) d on c.id = d.admin_id;
-- 管理员角色表
drop table admin_role cascade constraints purge ;
create table ADMIN_ROLE
(
admin_id NUMBER not null constraint admin_role_role_fk references admin_info(id) on delete cascade,
role_id NUMBER not null constraint admin_role_admin_fk references role(id)
);
alter table ADMIN_ROLE add constraint AR_PK primary key (ADMIN_ID, ROLE_ID);
-- 创建级联更新触发器
-- Create Or Replace Trigger g_Cardapply_Tr
-- After Update Of g_State On g_Cardapply
-- For Each Row
-- Begin
-- Update g_Cardapplydetail a
-- Set a.g_State = :New.g_State
-- Where a.g_State = :Old.g_State;
-- End;
-- insert into ADMIN_ROLE (admin_id, role_id)values (1, 1);
insert into admin_role values(1,1);
insert into admin_role values(1,2);
insert into admin_role values(1,3);
insert into admin_role values(2,1);
insert into admin_role values(3,1);
select * from admin_role ;
-- 权限表 -- role_info
drop table role cascade constraints purge ;
create table ROLE
(
id NUMBER not null, -- 主键,角色id
name VARCHAR2(20) -- 角色名称
);
alter table ROLE add constraint ROLE_PK primary key (ID);
select * from role ;
update role set name = '角色管理' where id = 1 ;
insert into role values (0,'全部');
insert into role values (1,'角色管理');
insert into role values (2,'管理员管理');
insert into role values (3,'资费管理');
insert into role values (4,'账务账号');
insert into role values (5,'业务账号');
insert into role values (6,'账单管理');
insert into role values (7,'报表');
-- insert into ROLE (id, name) values (1, '系统管理员');
-- 角色权限表
select * from role_privilege ;
drop table role_privilege purge;
create table ROLE_PRIVILEGE
(
role_id NUMBER not null, -- 角色id
privilege_id NUMBER not null -- 权限id,对应xml中的id
);
alter table ROLE_PRIVILEGE add constraint RP_PK primary key (ROLE_ID, PRIVILEGE_ID);
insert into ROLE_PRIVILEGE (role_id, privilege_id) values (1, 1);
insert into ROLE_PRIVILEGE (role_id, privilege_id) values (1, 2);
insert into ROLE_PRIVILEGE (role_id, privilege_id) values (1, 3);
insert into ROLE_PRIVILEGE (role_id, privilege_id) values (1, 4);
insert into ROLE_PRIVILEGE (role_id, privilege_id) values (1, 5);
insert into ROLE_PRIVILEGE (role_id, privilege_id) values (1, 6);
insert into ROLE_PRIVILEGE (role_id, privilege_id) values (1, 7);
commit;
select * from admin_role ;
select * from admin_role ;
select * from role;
select * from role_privilege ;
select * from role a join role_privilege b on a.id = b.role_id ;
select * from (select rownum rn,a.id,admincode,password,a.name,telephone,email,enrolldate from admin_info a join (select * from admin_role ) b on a.id = b.admin_id join (select * from role )c on b.role_id = c.id where rownum <= 5 and b.role_id = 1) where rn >=1 ;
select * from (select rownum rn,a.id,admincode,password,a.name,telephone,email,enrolldate from admin_info a join (select * from admin_role ) b on a.id = b.admin_id join (select * from role )c on b.role_id = c.id where rownum <= 5 and name like '%1%') where rn >=1
select * from admin_info ;
相关推荐
SQL语句是数据库操作的核心,它用于查询、插入、更新和删除数据,是任何数据库管理系统中的基础工具。在IT行业中,编写SQL语句是一项必备技能,但手动编写和调试SQL语句可能会耗费大量时间和精力,尤其在处理复杂...
本项目提供了一个Java源码工具,能够帮助用户便捷地将Oracle SQL语句转换为MySQL SQL语句。 Oracle SQL与MySQL SQL的主要差异在于以下几个方面: 1. **数据类型**:Oracle支持的数据类型如NUMBER、LONG、RAW等在...
sql语句说明sql语句说明sql语句说明sql语句说明sql语句说明sql语句说明sql语句说明sql语句说明sql语句说明sql语句说明sql语句说明sql语句说明sql语句说明sql语句说明sql语句说明sql语句说明sql语句说明sql语句说明...
"标签"进一步强调了这个工具的关键特性,包括"Java输出漂亮的SQL语句",这意味着它是一个Java环境下的解决方案,能够集成到Java项目中,通过Java代码来调用和实现SQL语句的格式化。另一个标签"SQL格式化"则明确了它...
"通过解析SQL语句获取表血缘关系项目"是一个针对数据库管理的实用技术,主要用于理解和跟踪数据的来源与流向,即血缘关系。血缘关系追踪在数据质量、合规性、审计和数据治理中扮演着关键角色。以下是关于这个主题的...
PB脚本中SQL语句写法与SQL中语句写法对照 PB脚本中SQL语句写法与SQL中语句写法对照是非常重要的知识点,因为PB脚本和SQL语言在写法和应用中有所不同。本文将对PB脚本中SQL语句写法和SQL中语句写法进行对比和分析。 ...
SQL Server 动态 SQL 语句的用法 SQL Server 中的动态 SQL 语句是一种灵活的查询方式,它可以根据不同的情况生成不同的 SQL 语句。动态 SQL 语句可以用来实现复杂的业务逻辑,提高查询效率和灵活性。 普通 SQL ...
在实际开发中,有时我们需要了解LINQ查询是如何转换为SQL语句的,以便于调试和优化性能。以下将详细介绍几种查看LINQ生成SQL语句的方法。 1. **Debug.WriteLine()** 在使用LINQ查询时,可以利用`Debug.WriteLine()...
"淘淘项目数据库sql语句"这个资源聚焦于一个名为"淘淘"的项目,它包含了一系列已经验证过的SQL(结构化查询语言)语句,这些语句适用于数据库操作和管理。SQL是用于管理和处理关系数据库的标准编程语言,其主要功能...
SQLTracker是一款专为数据库操作监控设计的工具,它在IT领域中主要用于跟踪和记录SQL语句的执行情况。SQL(Structured Query Language)是用于管理关系数据库的编程语言,包括查询、更新、插入和删除数据等操作。SQL...
### ArcGIS中的SQL语句详解 #### 一、SQL在ArcGIS中的角色与应用 SQL,全称为Structured Query Language,即结构化查询语言,是专为数据库设计的一种标准语言,用于管理和操作数据库中的数据。在ArcGIS环境中,SQL...
非常好用的SQL Server 抓取SQL语句工具HOOK 非常好用的SQL Server 抓取SQL语句工具HOOK 非常好用的SQL Server 抓取SQL语句工具HOOK 非常好用的SQL Server 抓取SQL语句工具HOOK
### 动态执行SQL语句在Oracle中的应用 #### 标题解读 “存储过程中怎么动态执行SQL语句”这一标题表明文章将介绍如何在Oracle数据库的存储过程中编写能够动态执行的SQL语句。动态SQL是指在运行时才能确定其具体内容...
动态拼接sql语句工具类,拼接where后面语句 配合原生jdbc仿动态sql注入 if (ObjectUtil.isNotEmpty(maxLat)&&ObjectUtil.isNotEmpty(minLat)){ sqlParamList.add(new SqlParam("lat",minLat, SqlOpEnum.GE)); ...
### Oracle 查看当前会话执行的SQL语句 在Oracle数据库管理中,有时我们需要了解某个特定会话(Session)正在执行哪些SQL语句。这在性能调优、问题诊断等场景下尤为重要。以下将详细介绍如何通过不同的方法来查看...
在IT行业中,MyBatis是一个广泛使用的持久层框架,它允许开发者直接编写SQL语句,提供了灵活的数据访问和映射机制。这篇博客“mybatis直接执行sql语句后续之一”可能探讨了如何在MyBatis中高效且有效地执行SQL操作。...
全面掌握SQL语句 详细的SQL语句介绍 详细的SQL语句介绍 详细的SQL语句介绍 详细的SQL语句介绍
小区物业管理系统配套数据库SQL语句,在Oracle中导入该SQL语句,数据库建立成功
在数据库管理系统(如MySQL、Oracle、SQL Server等)中,SQL语句是不可或缺的一部分。 1. SQL基础语法 SQL的基础语法包括SELECT、INSERT、UPDATE、DELETE四大语句,它们分别用于查询、插入、更新和删除数据。 - ...
XML 查询语句转换成 SQL 语句的实现 本文主要讨论将 XML 查询语句转换成 SQL 语句的实现。XML 已经成为 Internet 上数据交换的事实标准,特别是在 Web 数据挖掘技术中,对数据源的结构化需求导致人们对 XML 文档的...