Oracle Basic SQL statement-Add Update Data function Chapter

Source: Internet
Author: User

One, add data

/* Add Data */
Insert INTO STU values (' stu0004 ', ' Zhao Yiqian ', 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, all data must be listed at this point, and if the field is listed, then one by one corresponds, you must list all fields that are not empty, otherwise the error.

Second, update the data

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

Description: Set is followed by the data you want to update, where the condition is behind

Iii. increasing the number of columns

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

Description: Add kc_no column in Stu, where the constraint cannot be set to NULL unless there is no data in Stu

Iv. functions

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


/* There is worth the number of rows */
Select COUNT (stu_id) as number of rows from STU


Select COUNT (kc_no) as number of rows from Stu


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


/* Minimum value */
Select min (stu_age) as minimum age from STU


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

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.