数据库语言和复习之前的知识点

我们今天学习了数据库的语言先说一下添加一列:

alter table 表名 add 列名 类型 (长度)null

Alter  table  users  add  age  int;   Null,

1.更改列类型

Alter table teacher alter colum age varchar(3)


2.删除一列:

Alter table users drop column age;


3.主键约束

Alter  table  users  add  constraint  主键别名 primary key(id);

 

4.唯一键约束:

Alter table   users  add  constraint  唯一键别名 unique(name)

 

5.默认键约束:

Alter table  users  add   constraint  默认键 default (‘男’)for  sex

 

检查键约束:

Alter  table  users  add  constraint  检查键 check(age>=15and age<=40)

 

6.外键约束:

Alter  table  表名1  add  constraint  外键别名 foreignkey(外键)   reference(表名2,主键)

 

7.删除约束:

alter table score drop  constraint  删除键别名;

       声明:此篇文档时来自于【狗刨学习网】社区-unity极致学院,是网友自行发布的Unity3D学习文章,如果有什么内容侵犯了你的相关权益,请与官方沟通,我们会即时处理。

8.数据库的具体创建:

Creat  database  数据库名

On primary

(

Name= 数据文件别名(t_tk),

Filename =’d:\data\data.mdf,’

Size =25mb,

Maxsize=50mb,

Filegrowth=2mb,

)

 

Log on

(

Name =’third_ldf,' //日志文件别名

Size =5mb

Maxsize=25mb

Fiegrowth=10%

)

我又复习了一下以前的知识构造方法的格式和返回值的格式。

9.构造方法的格式:

[code]Class text {

 Int c=5,d=6;

 Public sum(int a){ 

 a=c+d;

 Console.WriteLine();

}

 Public sum(string b){

 b=c-d;

Console.writeLine();

  }

}

Static void Main(string []args){

Text o=new text();

O.sum(6);

O.sum(“9”);

Console.ReadKey();

}[/code]

10.返回值格式:

Class stu{

[code]Int a=8,b=9,c;

Public void get(){

 

  c=a+b;

Return c;

  }

}

Static void Main(string [] args){

Stu p=new stu();

P.get(5);

Console.ReadKey();

}[/code]

更多精彩:http://www.gopedu.com/article/category/cjwt

http://www.gopedu.com/article/category/jsfx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值