Oracle Learning Notes-Add Update data function article _oracle

Source: Internet
Author: User

One, add data

/* Add Data * *
INSERT INTO STU values (' stu0004 ', ' Zhao Yi ', 18,1, "kc0004");
Insert into STU (stu_id,stu_name,stu_age,stu_set) VALUES (' stu0013 ', ' storage 11 ', 19, 1);

Note: If you do not specify to add data to that field, then you must list all the data, if the field is listed, one by one corresponds, you must list all the fields with the constraint not empty, or the error.

Ii. Updating of data

/* Update Data * *
STU SET stu_age=19 WHERE stu_id= ' stu0001 '

Description: After set for the data you want to update, where is the condition

Third, add column

/* Add Column * *
ALTER TABLE STU ADD kc_no varchar2 (10)

Description: Add kc_no column in Stu, you cannot set constraint is not NULL, unless there is no data in Stu

Four, function

/* Average *
/select AVG (stu_age) as average from STU


/* There is a worth of rows
/select COUNT (stu_id) as rows from STU


Select COUNT (kc_no) as row count from Stu


/* Maximum
/select Max (stu_age) as maximum age from STU


/* min
/select min (stu_age) as minimum age from STU


/* Sum *
/select SUM (Stu_age) as and from STU

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.