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