Oracle + 9i & 10g programming Art: go deep into database architecture Reading Notes --- 1. Create a Scott/Tigger database table

Source: Internet
Author: User

Your database may already have the Scott/tiger schema. Classic installation usually includes this mode, but does not require the database to have this component. The Scott example mode can be installed under any database account. Using the Scott account has no special significance. If you are happy, you can also install the EMP/DEPT table directly under your own database account.

The following is the actual operation process.

1. Create a new user oracledba

Sqlplus "sys/sys as sysdba" Grant connect to oracledba; commit; Alter user oracledba quota unlimited on users; commit;

2. Execute the table creation statement

@ F: \ oracle \ ora92 \ sqlplus \ demo \ demobld. SQL

3. create constraints

Alter table emp add constraint emp_pk primary key (empno); alter table dept add constraint dept_pk primary key (deptno); alter table emp add constraint emp_fk_dept foreign key (deptno) References dept; alter table emp add constraint emp_fk_emp foreign key (MGR) References EMP;

4. To delete the Scott/Tigger database table, run

@ F: \ oracle \ ora92 \ sqlplus \ demo \ demodrop. SQL

Related Article

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.