Unity之列的基本操作和約束

2021-06-27 16:30:44 字數 1409 閱讀 9312

1.列的基本操作

1.增加列

格式:alter table 表名 add 列名 型別(長度) null

alter table students add age int null

2.更改列

格式:alter table 表名 alter column 列名 資料型別(長度)

alter table students alter column age varchar(3)

3.刪除列

格式:alter table 表名 drop column 列名

alter table students drop column age

2.約束

1.主鍵約束

格式:alter table 表名 add constraint 主鍵別名 primary key (主鍵列)

alter table students add constraint t_pr primary key(id)

2.唯一約束

格式:alter table 表名 add constraint 唯一鍵別名 unique (唯一鍵列)

alter table students add constraint t_un unique (id)

3.預設約束

格式:alter table 表名  add constraint 預設鍵別名 default (『預設值』) for 預設鍵

alter table students add constraint t__de default ('zhangsan')for name

4.檢查鍵約束

格式:alter table 表名 add constraint 檢查鍵別名check(stuage>=15 and stuage<=40)

alter table students add constraint t__ch  check(id>=101 and id<=126)

5.外來鍵約束

格式:alter table 表名1 add constraint  外來鍵別名 foreign key(外來鍵) references表名2(主鍵)

alter table stu add constraint t__fo foreign key(id) references students(id)

6.刪除約束

格式:alter table 表名  drop constraint 約束別名

alter table stu drop constraint t__fo

unity3D 列的基本操作和約束

列的基本操作 1.新增一列 alter table 表名 add 列名 型別 長度 null alter table teacher add age int null 2.更改一列型別 alter table 表名 alter column 列名 資料型別 長度 column 列 alter tab...

unity之資料庫的基本操作和arrylist

哈嘍,歡迎來到我們的 狗刨網,今天我們講了很多有趣的東西,有資料庫的約束,還有arrylist的應用,首先我們每天都會有新的更新,歡迎來到我們 的 上看哦。一 列的基本操作 增加一列 alter table 表名 add 列名 型別 長度 null 例如 alter table student ad...

Python學習之列表的建立及操作和深淺拷貝

1.空列表的建立 記憶體分配 元素的訪問取值和替換,新增,刪除,清除 元素段的擷取 出現的次數 最大值和最小值 建立乙個空列表 一般列表命名為list list1 print list1 建立乙個有元素的列表,list2在堆裡開闢空間,其中的元素在棧裡開闢空間 list2 10,30,54,5,6 ...