1、工具:php
一、phpMyAdmin (http://www.phpmyadmin.net/)mysql
二、Navicat (http://www.navicat.com/) sql
三、MySQL GUI Tools (http://dev.mysql.com/downloads/gui-tools/)服务器
2、语法:函数
数据类型工具 |
描述性能 |
应用范围ui |
int,smallintspa |
整型,经常使用int型,取值最大11位.net |
点击量,编号,真假 |
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]