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