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


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