Oracle database Add, 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) NOT NULL,  sname     varchar2 (8) is not NULL,  ssex      varchar2 (2) Not NULL,  sbirthday date,  sclass    varchar2 (5));--Add comments to the table comment on table Student are  ' students Table ';--Add comments to the columns comment in column Student.sno is  ' study number (main build) '; Comment on column student.sname is  ' Student name '; Comment on column student.ssex is  ' sex '; Comment on column student.sbirthday is  ' birthday '; Comment on column Stud Ent.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 write insert into student values (' 102 ', ' Zhang San ', ' Male ', Sysdate, ' 95033 '); select * FROM Student

2. Modification of the data:

--Data modification update student set ssex= ' female ' where sno= ' 102 ';--if you do not add where, you modify the properties of a column of an entire table--add and subtract an update to a column of data student set Sclass=sclass +1;update table Name set column name = column name +1 where condition--date plus minus 1 is day plus minus 1

3. Deletion of data:

--Deletion of data delete student where Sno=102;delete table name where condition;--no where, delete entire table, but inefficient, can be deleted by TRUNCATE TABLE name Re-build table) Example: TRUNCATE TABLE student;

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

--Data Query SELECT * FROM Student;select * 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 Add, 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.