oracle12c How to import Scott users

Source: Internet
Author: User


The above two figures are inserted into C # #scott用户及其测试数据后的正常运行图 ~ ~ ~

Begin the process of introduction.

  1. Start-run--cmdInput: Sqlplus/as SYSDBA connect to Database

2. Create a C # #scott用户
CREATE USER C # #scott identified by Tiger;
3. Authorizing the user
GRANT connect,resource,unlimited tablespace to C # #scottCONTAINER =all;
4. Set the table space used by the user
ALTER USER C # #scott DEFAULT tablespace USERS; ALTER USER C # #scott temporary tablespace TEMP;
5. Use C # #scott用户登录
CONNECT C # #scott/tiger
6. Delete Data Sheet
DROP TABLE emp  PURGE;D ROP Table Dept PURGE;D ROP table bonus PURGE;D ROP table Salgrade PURGE;
7. Create a data table
CREATE TABLE Dept (deptno Number (2) CONSTRAINT pk_dept PRIMARY key,dname VARCHAR2 (+), loc VARCHAR2 (13));  CREATE TABLE EMP (empno number (4) CONSTRAINT pk_emp PRIMARY key,ename VARCHAR2 (Ten), Job VARCHAR2 (9), Mgr Number (4), HireDate Date,sal number (7,2), comm Number (7,2), Deptno number (2) CONSTRAINT fk_deptno REFERENCES DEPT); CREATE TABLE Bonus (ename VARCHAR2 (Ten), Job VARCHAR2 (9)  , Sal Number,comm number); CREATE TABLE Salgrade (grade number,losal number,hisal number);

8. Insert test Data--dept
INSERT INTO Dept values (' ACCOUNTING ', ' NEW YORK '), insert into dept values (' "", ' DALLAS '); INSERT INTO Dept VAL UES (' SALES ', ' CHICAGO '); INSERT into Dept VALUES (+, ' OPERATIONS ', ' BOSTON ');

9. Insert test Data--emp
INSERT INTO EMP VALUES (7369, ' SMITH ', ' Clerk ', 7902,to_date (' 17-12-1980 ', ' dd-mm-yyyy '), 800,null,20); INSERT INTO EMP VALUES (7499, ' ALLEN ', ' salesman ', 7698,to_date (' 20-2-1981 ', ' dd-mm-yyyy '), 1600,300,30); INSERT into EMP VALUES (7521, ' WARD ', ' salesman ', 7698,to_date (' 22-2-1981 ', ' dd-mm-yyyy '), 1250,500,30); INSERT into EMP VALUES (7566, ' JONES ', ' MANAGER ', 7839,to_date (' 2-4-1981 ', ' dd-mm-yyyy '), 2975,null,20); INSERT into EMP VALUES (7654, ' MARTIN ', ' salesman ', 7698,to_ Date (' 28-9-1981 ', ' dd-mm-yyyy '), 1250,1400,30); INSERT into EMP VALUES (7698, ' BLAKE ', ' MANAGER ', 7839,to_date (' 1-5-1981 ', ' dd-mm-yyyy '), 2850,null,30); INSERT into EMP VALUES (7782, ' CLARK ', ' MANAGER ', 7839,to_date (' 9-6-1981 ', ' dd-mm-yyyy ') , 2450,null,10); INSERT into EMP VALUES (7788, ' SCOTT ', ' ANALYST ', 7566,to_date (' 19-04-1987 ', ' dd-mm-yyyy ') -85,3000,null INSERT INTO EMP VALUES (7839, ' KING ', ' president ', null,to_date (' 17-11-1981 ', ' dd-mm-yyyy '), 5000,null,10); insert Into EMP VALUES (7844, ' TURNER ', ' salesman ', 7698,to_date (' 8-9-1981 ', ' dd-mm-yyyy '), 1500,0,30); INSERT INTO EMP VALUES (7876, ' ADAMS ', ' Clerk ', 7788,to_date (' 23-05-1987 ', ' dd-mm-yyyy ') -51,1100,null,20); INSERT into EMP values ( 7900, ' JAMES ', ' Clerk ', 7698,to_date (' 3-12-1981 ', ' dd-mm-yyyy '), 950,null,30); INSERT into EMP VALUES (7902, ' FORD ', ' ANALYST ', 7566,to_date (' 3-12-1981 ', ' dd-mm-yyyy '), 3000,null,20); INSERT into EMP VALUES (7934, ' MILLER ', ' clerk ', 7782, To_date (' 23-1-1982 ', ' dd-mm-yyyy '), 1300,null,10);
10. Insert test Data--salgrade
INSERT into Salgrade values (1,700,1200), insert into Salgrade values (2,1201,1400), insert into salgrade values (3,1401,200 0) insert into Salgrade values (4,2001,3000), insert into Salgrade values (5,3001,9999);
11. Transaction Submission
COMMIT;

Test results as shown in the beginning of the two graphs ~ ~ ~
--------------------------------------------enjoy-----------------------------------------------------------
---------------------------------------------the end-----------------------------------------------------







Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.