Oracle Learning-7. Data processing

Source: Internet
Author: User

Data processing refers to the use of SQL's DDL statement, the table of information in the increase and deletion of the check.

Insert operation

INSERT  into    Table [(column [, Column ... ]]VALUES        [, Value ... ]);

Insert a null value into the table

Implicit: Omit this field from the Column name table

INSERT  into     departments (department_id,                           department_name    )VALUES        ( Purchasing ');

Display by: Performs a null value in the VALUES clause

INSERT  into     Departments VALUES        (Finance'nullnull);

Inserts the specified value

--record the current system time and dateINSERT  intoemployees (employee_id, first_name, last_name, email, phone_number, Hire_date, job_id, salary, commission_pct, manager_id, department_id)VALUES(113,                  'Louis','Popp',                  'Lpopp','515.124.4567', Sysdate,'Ac_account',6900,                  NULL,205, -);

Copy from other tables

--You do not have to write the VALUES clause. --the list of values in the subquery should correspond to the column names in the INSERT clauseINSERT  intoEMP2SELECT *  fromEmployeesWHEREdepartment_id=  -;INSERT  intosales_reps (ID, name, salary, commission_pct)SELECTemployee_id, last_name, salary, commission_pct fromEmployeesWHEREjob_id like '%rep%';

Update data

UPDATE        Table SET        column = [, column = value, ... ][WHERE         condition];

Using subqueries in Update

--Update the work and salary of employee No. 114th to make it with employee number NO. 205sameUPDATEEmployeesSETjob_id=(SELECTjob_id fromEmployeesWHEREemployee_id= 205), Salary=(SELECTSalary fromEmployeesWHEREemployee_id= 205) WHEREemployee_id=   the;

Delete statement

DELETE  from      Table [WHERE      condition];

Using subqueries in Delete

-- Remove department ID with public character in DEPT1 department name from EMP1 table DELETE  from EMP1 WHERE  =                        (SELECT  department_id                        from   dept1                           WHERElike  '%public%');

Database Things

Oracle Learning-7. Data processing

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.