1. Data type:
- Usually: character type, numeric type, date type, and large field type
- Large field type: store large data and files.
When storing large data, basically blob is enough.
2. DDL (Database Definition Language)
- It mainly includes the operation of creating, deleting and modifying database objects.
- DDL operation:
- Create
- Drop (delete)
- Alter (Modify)
2.1 create create data table syntax
2.1.1 Case demonstration
CREATE TABLE "TB_STUDENTS" (
"STU_NUM" CHAR(5) NOT NULL ENABLE,
"STU_NAME" VARCHAR2(10) NOT NULL ENABLE,
"STU_SEX" CHAR(1) NOT NULL ENABLE,
"STU_AGE" NUMBER(2,0),
"STU_TEL" CHAR(11)
) ;
2.2 Use the Alter statement to modify the data table
2.2.1 Adding columns
- Add a stu_email column to the tb_students table:
ALTER TABLE tb_students ADD stu_email char(50);
2.2.2 Modify the column (here demonstrates modifying the type in the column and changing it to varchar)
- Modify the type in stu_email in the tb_students table:
ALTER TABLE tb_students MODIFY stu_email varchar2(60);
2.2.3 Delete column
- Delete the stu_email column in the tb_students table:
ALTER TABLE tb_students DROP COLUMN stu_email;
2.3 Use the DROP statement to delete the data table
- Delete the student information table tb_students:
DROP TABLE tb_students;
2.4 Delete table data & delete data table
- Delete table data, delete the data stored in the data table, and retain the structure of the data table
Truncate table table_name
delete [from] table_name
- Delete the data table, delete the table structure (the data in the table will also be deleted at the same time)
Drop table table_name