Oracle 基礎(2) 建立表單

2021-08-07 18:17:22 字數 3162 閱讀 8787

建立表單

oracle中的資料型別

number(n) 數字( 最長n位 )

number(n , m) 浮點數( 總長n為, 小數點後m位 )

char(n)表示定長字串

varchar(n)表示變長字串( 節省空間 ) 

varchar2(n)oracle自己定義的變長字串

date 日期

建立乙個簡單的資料表

createtable dept_***(

deptnonumber(2) primary key,

dname varchar2(30) not null,//not null設定為非空

//dname varchar2(30) constraint student_name_nn not null,設定別名

dlocationvarchar2(30),

createtable dept_***(

deptnonumber(2),

dnamevarchar2(30),

dlocationvarchar2(30),

constraintdept_***_deptno_pk primary key (deptno));

//設定主鍵名dept_***_deptno_pk 主鍵為deptno (主鍵可以設計多行)

專業表create table major(

id number(2),

name varchar2(20),

constraintmajor_id_pk primary key(id));

學生表create tablestudent(

id number (2),

name varchar2(20),

major_id number(2),

constraintstudent_id_pk primary key(id),

constraintmajor_student_majorid_fk foreign key (major_id) references major(id) on delete set null);

設定外來鍵,外來鍵為major_id主鍵為major的id ,當主鍵表中刪除是,外來鍵表設定為null(級聯修改)

create table student(

s_numvarchar2 (12),

major_numnumber (2),

s_namevarchar2 (12),

s_***char (1),

heightnumber (3),

weightnumber (3),

birthdaydate,

native_placevarchar2 (20),

constraintstudent_num_pk primary key (s_num),

constraint major_student_major_num_fk

foreign

key(major_num) reference

smajor(major_num),

constraintstudent_check_***_ck check (lower(s_***) in('f', 'm')),

constraintstudent_check_height_ck check (height > 0),

constraintstudent_check_weight_ck check (weight > 0),

constraintstudent_check_birthday_ck check (

birthday> "to_date" ('1950-01-01', 'yyyy-mm-dd')

andbirthday < "sysdate"));

create table course(

c_numchar (6),

major_numnumber (2),

c_namevarchar2 (20),

typenumber (1),

creditnumber (2),

constraintcourse_num_pk primary key (c_num),

constraint major_course_major_num_fk

foreign

key(major_num) reference

smajor(major_num),

constraintcourse_check_type_ck check ("type" in(1,2,3)),

constraintcourse_check_height_ck check ("credit" > 0 and "credit"<= 0)

);create tablecourse_tm (

tm_numchar (6),

c_numchar (6),

constraintcourse_tm_num_pk primary key (tm_num,c_num),

constraintcourse_course_tm_c_num_fk foreign key (c_num) references course(c_num),

constraintteacher_course_tm_tm_num_fk foreign key (tm_num) referencesteaching_material(tm_num));

Yii2建立表單

文字框 textinput 密碼框 passwordinput 單選框 radio radiolist 核取方塊 checkbox checkboxlist 下拉框 dropdownlist 隱藏域 hiddeninput 文字域 textarea rows 3 檔案上傳 fileinput 提交按...

yii2 建立ActiveForm 表單

表單的生成 表單中的方法 activeform begin 方法 activeform end 方法 getclientoptions 方法 其它方法 errorsummary validate validatemultiple 表單中的引數 表單form自身的屬性 表單中各個項 field 輸入框...

oracle建立表基礎

2.在 使用者名稱 u 和 口令 p 輸入system的使用者名稱和密碼,預設為system和manager 或安裝時自己設定的密碼 確定無誤後你就能看到以下的介面了。3.建立表空間 test 大小100m create tablespace test logging datafile d orac...