二,SQL语句

数据类型定义:

lchar(n). Fixed length character string, with user-specified length  n.

lvarchar(n). Variable lengthcharacter strings, with user-specified maximum length n.

l int. Integer (a finite(有限的) subset of the integers that is  machine-dependent).

l smallint. Small integer (a machine-dependent subset of the  integer domain type).

l numeric(p,d). Fixed point number, with user-specified precision of pdigits, with d digits to the right of decimal point. 

l real, double precision.  Floating point and double-precision  floating point numbers, with machine-dependent precision.

l float(n). Floating point number, with user-specified precision  of at least n digits.

l date, time, timestamp, interval

l Each type mayinclude a special value called the null value

 

建立table

createtable department

  (dept_name varchar (20),

 building varchar (15),

 budget numeric (12,2),

 primary key (dept_name)); --设置主码

 

基本格式:

create table r

 (A1 D1,

A2 D2,

...,

An Dn,

(integrity-constraint1),...,

(integrity-constraintk));

 

删除table

drop table table_name

Deleteall information in the table

 

修改table

向某个表中增添一个属性

altertable table_name

add A D

(A is thename of  the attribute , and the D is thetype of A) 

 

向某个表中删除一条属性:

altertable table_name

drop A

(A is anattribute name.)

 

向表中插入数据:

insertinto table_name

values(D1, D2, D3, D4, D5...);

 

清空一个表:

deletefrom table_name

表中所有元祖都被删除,但是表依然存在,也就是说此时这个表是个空表。

 

更新操作:

updateinstructor

setsalary = salary * 5;

将工资增加到原来的五倍。

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值