Oracle database, data increase, delete, change, check

Source: Internet
Author: User

Oracle database, data increment, delete, change, check, through SQL statement implementation

SQL: Structured Query language;

Features: Case-insensitive, string enclosed in single quotation marks, end of statement end with semicolon;

Line comment, add "--" at the top of the statement

Block comments, respectively, before and after the statement Plus/* and/

Several common types of sql:

One, data definition language DDL: Create, modify, delete database language.

CREATE TABLE Student (Sno varchar2 (3) notNULL, sname varchar2 (8) notNULL, Ssex varchar2 (2) notNULL, Sbirthday date, Sclass varchar2 (5));--ADD comments to the table comment on table Student is' Student table ';--ADD comments to the columns comment in column Student.sno is' Study number (main building) '; Comment on column Student.sname is' Student name '; Comment on column Student.ssex isGender; Comment on column Student.sbirthday isBirthday; Comment on column Student.sclass is' Class ';

Ii. Data Manipulation Language DML: Add (insert INTO), modify (update set), delete data from the table. (delete)

1. Adding the data:

-- Add data insert into student (Sno,sname,ssex) VALUES (' 102 ', ' Zhang San ', ' Male '); -- or so write insert into student values (' 102 ', ' Zhang San ', ' Male ', sysdate, ' 95033' * FROM student

2. Modification of the data:

-- Data modification Update student set Ssex= ' female ' where sno= ' 102 '; -- If you do not add where, you are modifying the properties of a column of an entire table -- adding and minus update student set Sclass =sclass+1 forA column of data; Update table name set column name = column Name +1 WHERE Condition --the addition and subtraction of the date 1 is the plus and minus 1 of the day

3. Deletion of data:

-- Deletion of data delete student where Sno=102;d elete table name where condition; -- no where, that is, delete the entire table, but inefficient, can be used TRUNCATE table name to delete (first delete table, then build table) Example: TRUNCATE table student;

 

Third, data query Language DQL: Get the data from the table (query data).

--* * from table name; -- Find field by condition Select Sno,sname from student where sclass= ' 95031 '; Select field name from table name where condition

Oracle database, data increase, delete, change, check

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.