数据库
zeroZhou0
这个作者很懒,什么都没留下…
展开
-
mysql 更改数据库字符编码的方法
通过MySQL命令行修改:(编码可选)mysql> set character_set_client=utf8;mysql> set character_set_connection=utf8;mysql> set character_set_database=utf8;mysql> set character_set_results=utf8;mysql>转载 2017-10-10 21:33:39 · 658 阅读 · 0 评论 -
启动oracle服务有三种方式:
启动oracle服务有三种方式: 1 从控制面板 2 使用MS-DOS命令 3 通过Oracle Administration Assistant for WindowsNT-通过控制面板启动oracle服务 1)选择开始 > 控制面板 〉管理工具 --〉服务 2)找到你所要启动的oracle服务,单击启动-通过MS-DOS命令启动oracle服务 1)打开DOS窗口 ...转载 2017-10-27 19:33:50 · 734 阅读 · 0 评论 -
oracle数据库sql语句09 PL SQL程序结构 异常
PL/SQL程序结构 set serveroutput on--异常处理--no_data_founddeclarea emp%rowtype;beginselect * into a from emp where empno=108;dbms_output.put_line(a.ename||' '||a.job);exception when no_data_found...原创 2017-12-08 21:06:45 · 208 阅读 · 0 评论 -
oracle数据库sql语句10 存储过程
--创建存储过程set serveroutput on;--显示错误show error;--根据部门编号,输出该部门人数和平均工资create or replace procedure pro_m(dno in emp.deptno%type)asnum number(2);avgsal emp.sal%type;beginselect count(*),avg(sal) i...原创 2017-12-08 21:07:02 · 187 阅读 · 0 评论 -
oracle数据库sql语句11 函数
--函数set serveroutput on;--显示错误show error;--根据部门编号,输出该部门最大的工资create or replace function fun_maxsal(dno in emp.deptno%type)return emp.sal%typeasmaxsal emp.sal%type;beginselect max(sal) into ma...原创 2017-12-08 21:07:22 · 202 阅读 · 0 评论 -
oracle数据库sql语句14 数据库管理
conn system/12345678--查询所有用户状态select username,account_status from dba_users;--查询数据文件select tablespace_name, file_name from dba_data_files;--查询所有权限select * from system_privilege_map;--创建用户create user u...原创 2018-03-07 20:19:15 · 160 阅读 · 0 评论 -
oracle数据库sql语句13 触发器
/**----------------------- *语句级触发器 */ --创建emp副本emp1create table emp1 as select * from emp where 1=2;--插入触发器create or replace trigger trg_emp1_insert_output_numberafter insert on emp1declare num number...原创 2018-03-07 20:18:45 · 478 阅读 · 0 评论 -
oracle数据库sql语句08 PL SQL程序结构 循环 游标
PL/SQL程序结构 set serveroutput ondeclare season int :=3; info varchar2(50);begin season := &season; case season when 1 then info := season||'季度包含1,2,3月份'; when 2原创 2017-12-08 21:06:23 · 184 阅读 · 0 评论 -
oracle数据库sql语句07 PL SQL程序结构
PL/SQL程序结构set serveroutput on--求两数之和 ,之差 相除declare a number(2):=10; b number(2):=20; c number(7,2);begin a:=&num1; b:=&num2; c:=(a+b)/(a-b); dbms_output.put_line('结果为'||c);原创 2017-12-08 21:06:00 · 156 阅读 · 0 评论 -
oracle数据库sql语句06 join
--group byselect deptno,count(*) from emp group by deptno;--group by ... havingselect deptno, count(*) from emp group by deptno having count(*)>=5;--joinselec原创 2017-12-08 21:05:27 · 141 阅读 · 0 评论 -
oracle数据库sql语句12 包
--创建包create or replace package pkg_empasname emp.ename%type;procedure pro_emp(id emp.deptno%type, num out number);function fun_deptno(p_empno emp.empno%type, p_sal out number) return emp.e原创 2017-12-08 21:07:47 · 151 阅读 · 0 评论 -
oracle数据库sql语句05
conn system/12345678alter user scott account unlock; alter user scott identified by 123456; GRANT CREATE VIEW TO SCOTT;conn scott/123456create table emp1 as select * from emp;指定标签原创 2017-10-26 22:29:12 · 173 阅读 · 0 评论 -
oracle数据库sql语句03
select tablespace_name from dba_data_files; --查询表空间alter user scott account unlock; alter user scott identified by 123456; conn scott/123456 create table emp1 as sele原创 2017-10-19 22:51:29 · 136 阅读 · 0 评论 -
oracle数据库sql语句04
alter table emp1 add (firstname number(5), lastname number(5));alter table emp1 modify firstname varchar(20);alter table emp1 drop (firstname, lastname);alter table emp1 add constraint p_e原创 2017-10-19 22:53:26 · 140 阅读 · 0 评论 -
oracle数据库sql语句01
查询所有用户:select username,account_status from dba_users; 查询表信息:SQL> desc scott.emp名称 是否为空? 类型—————————————– ——– ——————— EMPNO原创 2017-10-10 21:47:37 · 282 阅读 · 0 评论 -
oracle数据库sql语句02
表操作:create table student (sid int primary key, sname varchar(10), sex char(1) check(sex in('m','w')), age int);#创建表alter table student rename to s; #修改表名称drop table student; #删除表修改表:al原创 2017-10-19 22:51:11 · 156 阅读 · 0 评论 -
mysql执行外部sql文件命令
执行sql脚本文件方法一 使用cmd命令执行(windows下,unix或linux在的其控制台下)【Mysql的bin目录】\mysql –u用户名 –p密码 –D数据库D:\mysql\bin\mysql –uroot –p123456 -Dtest注意:A、如果在sql脚本文件中使用了use 数据库,则-D数据库选项可以忽略B、如果【Mysql的bin目录】中包含空格转载 2017-10-10 19:27:38 · 600 阅读 · 0 评论 -
Mysql中文乱码问题完美解决方案
原文:http://www.2cto.com/database/201108/101151.htmlMySQL会出现中文乱码的原因不外乎下列几点:1.server本身设定问题,例如还停留在latin12.table的语系设定问题(包含character与collation)3.客户端程式(例如php)的连线语系设定问题强烈建议使用utf8!!!!utf8可以兼容世界上所有字符!!!!...转载 2017-10-24 22:09:49 · 201 阅读 · 0 评论