qintangtao

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2012年11月1日

摘要: 1:通过任务管理器或者服务管理,关掉mysqld(服务进程)2:通过命令行+特殊参数开启mysqldMysqld--skip-grant-tables3:此时,mysqld服务进程已经打开,并且,不需要权限检查.4:mysql-uroot无密码登陆服务器.5:修改权限表A:usemysql;B:updateusersetPassword=password('11111')whereUser='root';C:flushprivileges;6:通过任务管理器,或服务管理,关掉mysqld服务进程.7:再次通过服务管理,打开mysql服务.即可用修改后的新密码登陆 阅读全文
posted @ 2012-11-01 23:44 qintangtao 阅读(933) 评论(1) 推荐(0) 编辑

摘要: ------------------------------------if 条件表达式 then ..-------------------------------------- 编写一个过程,可以输入一个雇员名,如果该雇员的工资低于2000,就给雇员工资增加10%create or replace procedure sp_pro(spName varchar2) is --定义 v_sal emp.sal%type;begin --执行 select sal into v_sal from emp where ename=spName; --判断 if v_sal<2000 the 阅读全文
posted @ 2012-11-01 14:08 qintangtao 阅读(453) 评论(0) 推荐(0) 编辑

2012年10月30日

摘要: =====================mysql=====================select * from table_name limit 从第几条取,取几条=====================sql server=====================select top 4 * from 表名 where not in(select top 4 * from 表名 where 条件);排除前4条,再取4条=====================oracle=====================--第一层select * from emp;--第二层sel... 阅读全文
posted @ 2012-10-30 17:30 qintangtao 阅读(156) 评论(0) 推荐(0) 编辑

摘要: ①not null[非空] 该列不能为null②unique[唯一] 用于指定某列的值,不能重复,但可以是null[可以是多个null,在SqlServer只能是一个null]③primary key[主键] 用于唯一标识表行的数据,该列不能重复且不能为null④foreign key[外键] 用于定义主表和从表之间的关系 外键约束要定义在从表上 主表则必须具有主键约束或是unique约束 当定义外键约束后,要求外键列数据必须在主表的列存在或是null 外键列和主键列的数据类型要一致⑤check[检查] 用于强制行数据必须满足的条件注意事项:1、primary key和unique区别: 一个 阅读全文
posted @ 2012-10-30 17:27 qintangtao 阅读(462) 评论(0) 推荐(0) 编辑

摘要: =========================系统权限=========================指对数据库管理的操作以及对数据对象的操作[创建、删除、修改]如何查询有哪些系统权限? select * from system_privilege_map order by name;创建用户? create user tangtao identified by tangtao; 授予权限[重要]? grant create session to tangtao with admin option; --登录权限 grant create table to tangtao with ad 阅读全文
posted @ 2012-10-30 17:21 qintangtao 阅读(386) 评论(0) 推荐(0) 编辑

摘要: ====================内连接====================内链接实际上就是利用where子句对两张表形成的笛卡儿积 进行筛选====================外连接===================================================左外连接 left join .. on ..===============================左侧的表完全显示select stu.name,stu.id,exam.grade from stu [left join] exam [on] stu.id=exam.id;或者selec. 阅读全文
posted @ 2012-10-30 17:02 qintangtao 阅读(227) 评论(0) 推荐(1) 编辑

2012年10月29日

摘要: 1、返回所有列的数据+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //检索的学生名字和所在系 List<Student> list = session.createQuery("from Student").list(); for (Student student : list) { //System.out.println(student.getSname()+"选了"+student.getStudcourses().size()+&qu 阅读全文
posted @ 2012-10-29 15:23 qintangtao 阅读(876) 评论(0) 推荐(0) 编辑

摘要: openSession和getCurrentSession区别:深入讨论: 在SessionFactory启动的时候,Hibernate会根据配置创建相应的CurrentSessionContext 在getCurrentSession()被调用的时候,实际上执行的方法是:CurrentSessionContext.currentSession() 在currentSession()执行时,如果当前Session为空,currentSession会调用SessionFactory的openSession++++++++++++++++++++++++++++++++++++++++++++++ 阅读全文
posted @ 2012-10-29 15:22 qintangtao 阅读(374) 评论(0) 推荐(0) 编辑

摘要: --1、开发一个包create or replace package testpackage as --创建一个包,在该包中,定义了类型test_cursor ,是一个游标 type test_cursor is ref cursor;end testpackage;--2、编写过程create or replace procedure splitPages ( tableName in varchar2, --表名 pageSizes in number, --一页显示的记录数 pageNow in number, --当前第几页 ... 阅读全文
posted @ 2012-10-29 15:19 qintangtao 阅读(1397) 评论(0) 推荐(0) 编辑

摘要: ===========悲观锁===========悲观锁是指假设并发更新冲突会发生,所以不管冲突是否真的发生,都会使用锁机制。 悲观锁会完成以下功能:锁住读取的记录,防止其它事务读取和更新这些记录。其它事务会一直阻塞,直到这个事务结束。悲观锁是在使用了数据库的事务隔离功能的基础上,独享占用的资源,以此保证读取数据一致性,避免修改丢失。悲观锁可以使用Repeatable Read事务,它完全满足悲观锁的要求。 ===========乐观锁=========== 乐观锁不会锁住任何东西,也就是说,它不依赖数据库的事务机制,乐观锁完全是应用系统层面的东西。如果使用乐观锁,那么数据库就必须加版本字段. 阅读全文
posted @ 2012-10-29 15:17 qintangtao 阅读(1062) 评论(0) 推荐(0) 编辑