db2 常用sql

--查看所有的数据库

list active databases

--连接数据库

connect  to database

--创建表

create table Person(

name varchar(255) ,

age integer

)

--显示所有的表

list tables

--添加主键

alter table Person add primary key(name)

--添加唯一性

alter table Person add unique(name)

--添加非空

alter table Person add name set not null

--显示表结构

describe table  Person

--分页查询

select name ,age 

from (

select row_number() over(order by age asc) as row ,name,age

from Person

)

where row >10 and row <20


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章