-
decode函数的应用: SQL> select username,decode(username,'aaa','计算机部门','bbb','市场部门','其他' )as 部门 2 from users; USERNAME 部门 -------------------- ---------- aaa 计算机部门 bbb 市场部门 ccccc 其他 aaa 计算机部门查看全部
-
两种通过用户名查出部门的方法: SQL> select username,case username when 'aaa' then '计算机部门' 2 when 'bbb' then '市场部门' else '其他部门' end as 部门 3 from users; USERNAME 部门 -------------------- ---------- aaa 计算机部门 bbb 市场部门 ccccc 其他部门 aaa 计算机部门 SQL> select username, case when username='aaa' then '计算机部门' 2 when username='bbb' then '市场部门' else '其他部门' end as 部门 3 from users; USERNAME 部门 -------------------- ---------- aaa 计算机部门 bbb 市场部门 ccccc 其他部门 aaa 计算机部门查看全部
-
按工资降序,用户名升序排名 SQL> select * from users order by username desc,salary asc; ID USERNAME SALARY ---------- -------------------- ---------- 3 ccccc 5000.5 2 bbb 1801 1 aaa 800 4 aaa 1000查看全部
-
通配符_代表一个字符 %代表0到多个字符查看全部
-
运算符的使用: SQL> select username from users where salary>800 or salary<>1801;查看全部
-
使用算术运算符 SQL> select id,username,salary+200 from users; 编号; 用户名; SALARY+200 ---------- -------------------- ---------- 1 aaa 1000 2 bbb 2001 3 ccccc 5200.5查看全部
-
查询时重命名字段查看全部
-
nvarchar2 和varchar2 都可以表示可变长度的字符,其中nvarchar2用于存储 Unicode格式的数据,更适合存储中文数据。查看全部
-
oracle卸载 在安装目录下dbhome_1/deinstall/deinstall.bat查看全部
-
1、数据字典:dba_tablespaces(系统用户)、user_tablespaces(普通用户)。 2、用 desc+数据字典名; 命令可以查看表空间数据字典的信息。 3、系统用户可以查看系统和普通用户的表空间数据字典信息,普通用户只能查看自己的。 4、数据字典:dba_users(系统用户)、user_users(普通用户),用法同上 5、ALTER USER username DEFAULT|TEMPORARY TABLESPACE tablespace_name;设置用户默认或临时表空间查看全部
-
主从表中想应的字段必须是用一个数据类型查看全部
-
设置外键约束时主表的字段必须是主键查看全部
-
后建的表为从表查看全部
-
如何在Oracle中复制表结构和表数据 1. 复制表结构及其数据: create table table_name_new as select * from table_name_old 2. 只复制表结构: create table table_name_new as select * from table_name_old where 1=2; 或者: create table table_name_new like table_name_old 3. 只复制表数据: 如果两个表结构一样: insert into table_name_new select * from table_name_old 如果两个表结构不一样: insert into table_name_new(column1,column2...) select column1,column2... from table_name_old查看全部
-
create tablespace test1_tablespace datafile 'test file.dbf' size 10m; 创建永久表空间 create temporary tablespace test1_tablespace temple 'temple.dbf' size 10m; 创建临时表空间查看全部
举报
0/150
提交
取消