To create a table:
1 --To Delete a table:2 --Delete the existing table with the same name before creating the table, ensuring that you can create a success. 3 --but this is a very dangerous operation and it can be very bad to delete a table that should not be deleted. 4 Drop Tablet_emp;5 --To Create a table:6 Create Tablet_emp7 (8Empno Number not NULL,9EmpNamevarchar( -) not NULL,TenGendernvarchar(1) not NULL, OneAge Number not NULL, ACreatetime DatedefaultSysdate, -IsdeleteChar(1)default('N') not NULL, - --Create constraints (PRIMARY KEY constraint, UNIQUE constraint, check constraint) the constraintPk_empnoPrimary Key(empno), - constraintU_empnameUnique(empname), - constraintC_isdeleteCheck(Isdeleteinch('Y','N') -);View CodeInsert Record:
1 /*Inserting Records*/2 3 --Full Fill4 Insert intot_emp5 (6 empno,7 EmpName,8 Gender,9 Age .Ten Createtime, One Isdelete A ) - Values - ( the 'x1234567', - 'Cloud Long', - 'male', - ' -', + Sysdate, - 'N' + ); A at --fill only two non-repeatable fields - Insert intot_emp - ( - empno, - EmpName - ) in Values - ( to 'x1234568', + 'Zhao Zilong' -);
View CodeTo delete a record:
1 -- Deleting Records 2 Delete from t_emp 3 where empno='x1234567';
View CodeUpdate record:
1 Update t_emp 2 set empno='x7654321'3where empno= ' x1234567 ';
View CodeQuery record:
1 Select 2 from t_emp3where rownum<=2;
View Code
Oracle SQL sample