On the problem of no scott user in Oracle12c

I am currently previewing through videos, learning that the teachers in the videos here want to log in to Scott users, but I can not log in, showing that users do not exist. Although the scott.sql file can also be found in Oracle files, but after creating users through online tutorials, I feel very troubled and unsuccessful, and finally after a lot of consulting, I come to the conclusion. Personal conclusion:

 

I'm using Oracle 12c now. As far as I can see, 12c should not be defaulted to scott users either backward or backward.

I don't think we need to create a user like online tutorials anymore. We can use system users. scott's function is to practice. There are four tables in Scott users. These four tables are given directly, including the data in them. We can use these four tables to practice directly. So our direction is It should be those four tables, because we are working on tables, so we can practice using them by creating these four tables in the system user.

 

Reference from: https://www.cnblogs.com/lcchuguo/p/5118809.html

 

Create DEPT tables

CREATE  TABLE  DEPT  (

DEPTNO  NUMBER(2)  CONSTRAINT  PK_DEPT   PRIMARY KEY,

DNAME  VARCHAR2(14) ,  

LOC  VARCHAR2(13) 

) ; 

 

Table DEPT Add Data

INSERT  INTO  DEPT  VALUES  (10  ,  'ACCOUNTING'  ,  'NEW YORK'  );  

COMMIT;

INSERT  INTO  DEPT  VALUES  (20  ,  'RESEARCH'  ,  'DALLAS'  );  

COMMIT;

INSERT  INTO  DEPT  VALUES  (30  ,  'SALES'  ,  'CHICAGO'  );  

COMMIT;

INSERT  INTO  DEPT  VALUES  (40  ,  'OPERATIONS'  ,  'BOSTON'  );  

COMMIT;

 

 

 

Create EMP tables

CREATE  TABLE  EMP  (

EMPNO  NUMBER(4)    CONSTRAINT PK_EMP PRIMARY KEY,  

ENAME  VARCHAR2(10),  

JOB  VARCHAR2(9),  

MGR  NUMBER(4),  

HIREDATE  DATE,  

SAL  NUMBER(7,2),  

COMM  NUMBER(7,2),  

DEPTNO  NUMBER(2) CONSTRAINT FK_DEPTNO REFERENCES DEPT

);  

 

Table EMP Add Data

INSERT   INTO   EMP   VALUES  (7369,'SMITH','CLERK',7902,to_date('17-12-1980','dd-mm-yyyy'),800,NULL,20);

COMMIT;
INSERT   INTO   EMP   VALUES  (7499,'ALLEN','SALESMAN',7698,to_date('20-2-1981','dd-mm-yyyy'),1600,300,30);

COMMIT;
INSERT   INTO   EMP   VALUES  (7521,'WARD','SALESMAN',7698,to_date('22-2-1981','dd-mm-yyyy'),1250,500,30);

COMMIT;
INSERT   INTO   EMP   VALUES  (7566,'JONES','MANAGER',7839,to_date('2-4-1981','dd-mm-yyyy'),2975,NULL,20);

COMMIT;
INSERT   INTO   EMP   VALUES  (7654,'MARTIN','SALESMAN',7698,to_date('28-9-1981','dd-mm-yyyy'),1250,1400,30);

COMMIT;
INSERT   INTO   EMP   VALUES  (7698,'BLAKE','MANAGER',7839,to_date('1-5-1981','dd-mm-yyyy'),2850,NULL,30);

COMMIT;
INSERT   INTO   EMP   VALUES  (7782,'CLARK','MANAGER',7839,to_date('9-6-1981','dd-mm-yyyy'),2450,NULL,10);

COMMIT;
INSERT   INTO   EMP   VALUES  (7788,'SCOTT','ANALYST',7566,to_date('19-04-1987','dd-mm-yyyy')-85,3000,NULL,20);

COMMIT;
INSERT   INTO   EMP   VALUES  (7839,'KING','PRESIDENT',NULL,to_date('17-11-1981','dd-mm-yyyy'),5000,NULL,10);

COMMIT;
INSERT   INTO   EMP   VALUES  (7844,'TURNER','SALESMAN',7698,to_date('8-9-1981','dd-mm-yyyy'),1500,0,30);

COMMIT;
INSERT   INTO   EMP   VALUES  (7876,'ADAMS','CLERK',7788,to_date('23-05-1987','dd-mm-yyyy')-51,1100,NULL,20);

COMMIT;
INSERT   INTO   EMP   VALUES  (7900,'JAMES','CLERK',7698,to_date('3-12-1981','dd-mm-yyyy'),950,NULL,30);

COMMIT;
INSERT   INTO   EMP   VALUES  (7902,'FORD','ANALYST',7566,to_date('3-12-1981','dd-mm-yyyy'),3000,NULL,20);

COMMIT;
INSERT   INTO   EMP   VALUES  (7934,'MILLER','CLERK',7782,to_date('23-1-1982','dd-mm-yyyy'),1300,NULL,10);

COMMIT;

 

 

 

Create SALGRADE tables

CREATE   TABLE   SALGRADE    (

GRADE   NUMBER,  

LOSAL   NUMBER,  

HISAL   NUMBER 

);  

 

Table SALGRADE Add Data

INSERT   INTO   SALGRADE   VALUES   (1,700,1200);  

COMMIT;

INSERT   INTO   SALGRADE   VALUES   (2,1201,1400);  

COMMIT;

INSERT   INTO   SALGRADE   VALUES   (3,1401,2000);  

COMMIT;

INSERT   INTO   SALGRADE   VALUES   (4,2001,3000);  

COMMIT;

INSERT   INTO   SALGRADE   VALUES   (5,3001,9999);  

COMMIT;

 

 

 

Create BONUS tables

CREATE   TABLE   BONUS    (  

ENAME   VARCHAR2(10)  , 

JOB   VARCHAR2(9)  ,  

SAL   NUMBER,  

COMM   NUMBER  

) ;  

 

 

That's my point of view. If there's anything wrong, please point it out.

Beginners on the road, but also want to ask a question is:

Do COMMIT need to be added after each INSERT INTO statement?

Thank you!

 

Author: Man in the Storm

Origin: https://www.cnblogs.com/xuqx/ 

Welcome to reprint, reprint please indicate the source.

If you think this article is good enough to help you with your study, please click on the recommendation in the lower right corner.

Keywords: Oracle SQL

Added by NightFalcon90909 on Fri, 09 Aug 2019 14:03:45 +0300