##### Oracle.com
I. Commands
Syntax :
CREATE [OR REPLACE] <table name> (column name datatype(size),....);
Example :
CREATE TABLE employee
( eno number(7),ename varchar2(20),job varchar2(20),doj date,sal number(8),comm number(6),deptno number(5));
Out Put :
SQL> CREATE TABLE employee ( eno number(7),ename varchar2(20),job varchar2(20),doj date,sal number(8),comm number(6),deptno number(5));
Table created.
2.Table Description
Syntax :
DESC <table name>;
Example :
DESC employee;
Output :
SQL> desc employee
Name Null? Type
----------------------------------------- -------- ----------------------------
ENO NUMBER(7)
ENAME VARCHAR2(20)
JOB VARCHAR2(20)
DOJ DATE
SAL NUMBER(8)
COMM NUMBER(6)
DEPTNO NUMBER(5)
3.Insert record in to table
Syntax :
INSERT into < table name > values (&colname1,&colname2,......);
Example :
INSERT into employee values (&eno,'&ename','&job','&doj',&sal,&comm,&deptno);
Output :
SQL> INSERT into employee values (&eno,'&ename','&job','&doj',&sal,&comm,&deptno);
Enter value for eno: 001
Enter value for ename: Lakshman
Enter value for job: Developer
Enter value for doj: 22JAN1989
Enter value for sal: 50000
Enter value for comm: 1000
Enter value for deptno: 001
old 1: INSERT into employee values (&eno,'&ename','&job','&doj',&sal,&comm,&deptno)
new 1: INSERT into employee values (001,'Lakshman','Developer','22JAN1989',50000,1000,001)
1 row created.
4.Select records in table
Syntax :
SELECT * FROM < table name >[where <condition>];
Example :
SELECT * FROM employee;
Output :
SQL>SELECT * FROM employee;
ENO ENAME JOB DOJ SAL COMM DEPTNO
---------- -------------------- -------------------- -------- ----------- --------- ----------
1 Lakshman Developer 22-01-89 50000 1000 1
CREATE USER MIG61 IDENTIFIED BY test_usr;
GRANT CONNECT,RESOURCE,DBA TO test_usr;
GRANT UNLIMITED TABLESPACE TO test_usr;
SELECT USER FROM DUAL;
ALTER SESSION SET CURRENT_SCHEMA = test_usr;
SELECT * FROM dba_directories;
DROP TABLE testdata_BFILE;
DROP DIRECTORY test_usr;