1.
Example of creating a table: ——Student
table
sql>create table student (——table name
xh number(4),——student number
xm varchar2(20),——name
sex char(2),——gender
birthday date ,——date of birth
sal number(7,2)——scholarship
);
——class table
sql>create table classes (
classid number(2),
cname varchar2(20));
2. Modify table
1) to add a field
sql >alter table student add(classId number(2));
2) Modify the length of the field
sql>alter table student modify (xm varchar2(30));
3) Modify the type/or name of the field (no data)
sql>alter table student modify(xm char(30));
4) Delete a field (not recommended in actual development)
sql>alter table student drop column sal;
5) Modify the name of the table
sql>rename student to stu;
6) Delete table
sql>drop table student;
3. View table structure
sql>desc table name