2018.5.28 Oracle Database Supplement

Source: Internet
Author: User

SELECT * FROM (select RowNum rn,e2.* from (select e1.* from EMP E1) E2 where rownum<=10) E3 where e3.rn>=6;

SELECT * FROM (select RowNum en,e.* from emp e)

Select E.deptno,e.ename,d.dname,e.mgr,s.grade
From (select AVG (SAL) ea from emp) e1,emp E,salgrade s,dept D
where E.deptno=e.mgr
and D.deptno=e.deptno
and e.sal>e1.ea;

--Copy table data
CREATE TABLE Emps as SELECT * from EMP;

--View Table contents
DESC EMP;
Select table_name from all_tables where Owner=upper (' Legend ');

--Copy table structure
CREATE TABLE Empnew as SELECT * from EMP where 1<>1;

--Example: creating a student table
The---fields are as follows:
--School Number
--Name
--Gender
--Date of birth
--Scholarships
CREATE TABLE Student (
Sno Number (4),
sname varchar (20),
Sex varchar (2) CHECK (Sex in (' Male ', ' female ')),
Birthday date,
Scholarship Number (15)
);

--Example: Creating a Class Table
--Fields are as follows
--Class number
--Class name
CREATE TABLE Class (
Classno Number (3),
ClassName varchar (5)
);

--Expand new Field (column) to increase and revise the search
--Add Class table one field class teacher
ALTER TABLE class Add (Classteacher char (12));

--Modify Fields
ALTER TABLE class Modify (Classteacher varchar2 (10));

--delete field (delete class teacher field)
ALTER TABLE class drop column classteacher;

--Inserting data
Insert into table name (Field 1, Field 2) VALUES (value 1, value 2)

2018.5.28 Oracle Database Supplement

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.