Oracle Course archive, day fifth

Source: Internet
Author: User

Collection operations

Desc job_history: Changing the position of history


Job_history: History table

Vnion: Duplicate values retain only one remove duplicate value ★

Vnion all: Retain all duplicate values without removing duplicate values ★

Intersect: Intersect

Minus: minus

Double quotation marks to the nonstandard object name ★

Single quotation mark is a string ★

DESC departments Query what columns are in the Department table

Desc employees query What columns are in the employee table


Select employee_id, job_id from Employees
UNION ALL
Select employee_id, job_id from Job_history;

Select employee_id, job_id from Employees
Union
Select employee_id, job_id from Job_history;

Select employee_id, job_id from Employees
Intersect
Select employee_id, job_id from Job_history;

Select employee_id from Employees
Minus
Select employee_id from Job_history;

Select employee_id, job_id, salary from employees
UNION ALL
Select employee_id, job_id, null from job_history;

Select employee_id, job_id, To_char (salary) from employees
UNION ALL
Select employee_id, job_id, ' no salary ' from job_history;

Collection Sort:
Select employee_id, job_id, salary from employees
UNION ALL
Select employee_id, job_id, null from Job_history
Order by salary;

Select employee_id, job_id, null from Job_history
UNION ALL
Select employee_id, job_id, salary from employees
Order by 3;

Salary null and Sky value personal understanding


To create a table:

CREATE TABLE: Creating tables

INSERT INTO: inserting

Update: Updates

Delete: Remove data from table

Drop: Delete Table

Constraint: Constraint commit: Commit the creation of the table after the completion of the commit must be committed;

NOT null: Non-empty

View: Views drop sequence course_cid; Delete the name of the increment if you repeat, use this to delete the duplicate name Coure_cid created for you to delete.

Sequence: Sequence

Uniquenes: Uniqueness of start with: from .... Begin

VARCHAR2: Long characters

Modify: Modify, add

Primary key (primary key) constraints, foreign key (foreign key) constraints, unique (unique) constraints, check constraints, defaults (default) constraint instances


There are several types of constraints:
C (check constraint on a table)
P (primary key)
U (Unique key)
R (referential AKA Foreign Key)
V (with CHECK option, on a view)
O (with Read only, on a view)

Dml

X: first column + data type

Y: Second column + character type--character type must be enclosed in single quotation marks

Z: Third column + Date type


SELECT * from + table name + What to look for

desc+ table name can also be checked

Delete table: drop table + tables name

User_table: Name of all tables under current user

Delete Row (delete data): Delete from table + which row

Ddl

Modify Table Structure

ALTER TABLE T1 xxxxxx★★

Delete column: Alter t1 drop X

CREATE TABLE T1 (x (column name) int (type) constraint (constraint) T1_X_PK (the name of the constraint) PrimaryKey (primary key));

Oracle Course archive, day fifth

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.