數據庫經常使用語句

建立數據庫 數據庫

create database 數據庫名it

建立表和字段date

CREATE TABLE 表名(select

id int(11) AUTO_INCREMENT, 分頁

字段名 varchar(30) ,float

hp float ,im

damage int(11) ,數據

PRIMARY KEY (id)查詢

) DEFAULT CHARSET=utf8;tab

查詢語句

select * from 表名 所有查詢

查詢多少條數據

select count(*) from表名o

分頁查詢

select * from 表名 limit 0,5

修改數據

update 表名 set 字段名= 818 where id = 1

刪除數據

delete from 表名where id = 1

約束

PK 主鍵

constraint primary key

1

UK 惟一約束

constraint unique key

1

DF 約束默認

constrint default for

1

CK 檢查約束

constraint check()

1

FK 主外鍵關係

constraint foreign references

相關文章
相關標籤/搜索