日期:2014-05-16 浏览次数:20453 次
create table t_student( student_id number(10), student_name varchar2(30), sex char(2), birthday date, email varchar2(30), classes_id number(10) );
insert into t_student(student_id,student_name,sex,birthday,email,classes_id) values(1000,'zzg',to_date('1985-10-30','yyyy-mm-dd'),1234);
create table t_student( student_id number(10), student_name varchar2(30), sex char(2) default '男', birthday date default sysdate, email varchar2(30), classes_id number(10) );
create table t_student( student_id number(10), student_name varchar2(30) not null, sex char(2) default '男', birthday date default sysdate, email varchar2(30), classes_id number(10) );
create table t_student( student_id number(10), student_name varchar2(30) constraint student_name_not_null not null, sex char(2) default '男', birthday date default sysdate, email varchar2(30), classes_id number(10) );
select constraint_name from user_constraints;
create table t_student( student_id number(10), student_name varchar2(20), sex char(2), birthday date, email varchar2(30) unique, classes_id number(3) );
create table t_student( student_id number(10), student_name varchar2(20), sex char(2), birthday date, email varchar2(30) constraint email_unique unique, classes_id number(3) );
create table t_student( student_id number(10), student_name varchar2(20), sex char(2), birthday date, email varchar2(30), classes_id number(3), constraint email_unique unique(email) );
create table t_student( student_id number(10) primary key, student_name varchar2(20), sex char(2), birthday date, email varchar2(30), classes_id number(3) );
--字段级约束 create table t_student( student_id number(10) constraint pk_student_id primary key, student_name varchar2(20), sex char(2), birthday date, email varchar2(30), classes_id number(3) ); --表级约束 create table t_student( student_id number(10), student_name varchar2(20), sex char(2), birthday date, email varchar2(30), classes_id number(3), constraint pk_student_id paimary key(student_id) );
create table t_student( student_id number(10), student_name varchar2(20), sex char(2), birthday date, email varchar2(30), classes_id number(3), constraint pk_student_id paimary key(student_id,student_name) );
--首先建立班级表t_classes create table t_classe