1. Oracle Statement Data Definition language (DDL)
1) CREATE table new tables
2) ALTER TABLE modification
3) Example of TRUNCATE table data:TRUNCATE table Stu;
4) DROP TABLE Delete tables
alter usage :
1. Add a field to the table:
ALTER TABLE Stu add age int;
2. Delete the fields in the table:
ALTER TABLE Stu drop column age;
3. Rename the field:
ALTER TABLE stu rename column sid to S#;
4. Change the data type of the field:
ALTER TABLE test00 Modify SSID varchar2 (10);
Note: You cannot change the data type of a field when the column is not empty
You can do this in the following ways:
New column B-Import a column of data -empty column A-convert a column type -import B Data transformation.
Example:
ALTER TABLE Stu add SSS float;
Update Stu set Sss=shigh;
Update stu Set shigh = null;
ALTER TABLE Stu Modify Shigh varchar2 (10);
Update stu Set shigh = SSS;
ALTER TABLE STU drop column SSS;
2. Data manipulation Language (DML) for Oracle statements
Data manipulation Language (DML):Select Delete Update Insert
1. Inserting data Insert
The column names can be omitted when the data is inserted in the same order, quantity, and table.
Insert into Stu values ();
The column name must be indicated when the inserted data order or quantity is inconsistent with the table.
INSERT into students (id,name) VALUES (10139, ' King II ');
2. Updating Data update
Syntax format:
Update <table_name> Set <column_name>= ...
[WHERE condition (s)];
--Update all records in this column without using the WHERE clause.
--use the WHERE clause to update the eligible records in this column.
3. Delete the data delete, TRUNCATE TABLE
Syntax format:
DELETE from <table_name>
[WHERE condition (s)];
--Delete all records in the table without using the WHERE clause.
--Use the WHERE clause to delete the qualifying records in the table.
3, Oracle Statement of Things Control Language (TCL)
Transaction Control Language (TCL): Commit savepoint rollback
Commit-commit and end transaction processing
ROLLBACK-undo completed work in a transaction
savepoint– marks a point in a transaction that can be rolled back
Example:
SavePoint A1;
Update stu set sname= ' white ' where id=3;
SELECT * from Stu;
SavePoint A2;
Delete from Stu where id=2;
SELECT * from Stu;
SavePoint A3;
Rollback to savepoint A2;
Rollback to the location of A2, a2 after the operation is all obsolete.
4. Oracle Statement Data Control Language (DCL)
Data Control Language (DCL): Grant Revoke
Licensing and Recycling permissions
Oracle Statement Subtotals