標籤:
一、工具:
1、phpMyAdmin (http://www.phpmyadmin.net/)
2、Navicat (http://www.navicat.com/)
3、MySQL GUI Tools (http://dev.mysql.com/downloads/gui-tools/)
二、文法:
資料類型 |
描述 |
應用範圍 |
int,smallint |
整型,常用int型,取值最大11位 |
點擊量,編號,真假 |
char ,varchar |
字串型,char最大取值255位元組,varchar更長並伸縮 |
標題,姓名,關鍵字 |
Date,datime |
日期型,固定格式: 0000-00-00 00:00:00 |
|
float ,double |
小數類型,一般設定類型為 (總長度,小數位長度) |
價格,科學數值等 |
Text,longtext |
備忘型:沒有長度限制,但取決於伺服器和mysql效能 |
新聞內容,長內容 |
Insert into 表 (欄位1,欄位2…)values (值1,值2)
Insert into 表 values (值1,值2)
Insert into 表 set 欄位1=值1,欄位2=值2,……
Select 欄位,欄位,…… from 表
Select * 或 函數(欄位) from 表
count(*) //統計條數
sum (欄位) //求和
avg(欄位)//求平均值
max(欄位)//求最大值
min (欄位)//求最小值
Select 欄位,欄位,…… from 表 where 條件
欄位 【 條件運算子】 值如: = , > , < , <> , and , or
函數:replace()
Select 欄位,欄位,…… from 表 where 欄位 like ‘%值%’
Select 欄位,欄位,…… from 表 where 欄位 not like ‘%值%’
Select 欄位,欄位,…… from 表 where 欄位 in (值,值)
Select 欄位,欄位,…… from 表 where 欄位 not in (值,值)
Select 欄位,欄位,…… from 表 group by 欄位
Select 欄位,欄位,…… from 表 order by 欄位 [asc / desc ]
Select 欄位,欄位,…… from 表 limit 起始位 ,條數
Select * from user where age<30 group by job order by id desc limit 10
Update 表 set 欄位=值 , 欄位=值 [where] [group] [order] [limit]
delete from 表 [where] [group] [order] [limit]
PHP學習之[第08講]資料庫MySQL基礎之增刪改查