Oracle資料庫的基本命令

2022-03-19 07:45:30 字數 867 閱讀 3332

基本命令sqlplus的命令

1.檢視使用者scott表

2.基本命令sqlplus的命令

3.對於寫錯的命令,可以有以下方便步驟修改:

[輸錯的命令]

ed //資料庫會開啟記事本,在記事本中修改命令

/ //重複上次執行的命令

去掉重複列

select distinct deptno from emp;

4.sql語句書寫標準

5.定義空值 null

控制是無效的,未指定的,未知或不可預知的值

空值不是空格或者0

出錯示例:

select empno, ename, sal*12 年薪, (sal*12 + comm) 年收入 from emp;

正確示例:

select empno, ename, sal*12 年薪 , (sal*12 + nvl(comm,0)) 年收入 from emp;

查詢獎金為空的員工

select * from emp where comm is null;

查詢獎金不為空的員工

select * from emp where comm is not null;

有關虛表(偽表)

select 的檢索列可以來自任何地方,原理是用到了虛表。

select '111' || '2222' "連線" , empno, ename from emp;

資料庫基本命令

增刪改查 select 從資料庫中提取資料 update 更新資料庫中的資料 delete 從資料庫中刪除資料 insert into 向資料庫中插入新資料 唯一性查詢 sql select distinct 插入語句 insert into websites name,url,alexa,coun...

資料庫的基本命令

create database databasenameon name datebasename data,資料檔案的邏輯檔名 filename 該資料檔案的儲存路徑 datebasename data.mdf size 10,檔案初始大小,單位為m maxsize 50 檔案最大值 filegro...

資料庫的基本命令

mysql資料庫修改密碼命令 mysqladmin u root p123456 password 4567890 f7檢視命令列表 使用者許可權 grant all privileges on home.to user localhost identified by 12345 指定現在在使用的資...