当前位置: 首页 > 图文教程 > 网络编程 > PHP > php教程:mysql的常用语句

PHP
php简单的分页程序
加强版phplib的DB类
PHP 数字左侧自动补0
mysql+php分页类(已测)
php读取30天之内的根据算法排序的代码
在php MYSQL中插入当前时间
用php获取远程图片并把它保存到本地的代码
生成php程序的php代码
在PHP中读取和写入WORD文档的代码
用来给图片加水印的PHP类
php md5下16位和32位的实现代码
php出现Cannot modify header information问题的解决方法大全
PHP提取中文首字母
php Ajax乱码
php时间不正确的解决方法
php的access操作类
如何在PHP程序中防止盗链
PHP中的extract的作用分析
PHP中用header图片地址 简单隐藏图片源地址
PHP防注入安全代码

PHP 中的 php教程:mysql的常用语句


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 179 ::
收藏到网摘: n/a

显示数据库或表:

    show databases;//然后可以use database_name;
    show tables;

更改表名:

    alter table table_name rename new_t;

添加列 :

    alter table table_name add column c_n column attributes;

删除列:

    alter table table_name drop column c_n;

创建索引:

    alter table c_table add index (c_n1,c_n2);
    alter table c_table add unique index_name(c_n);
    alter table c_table add primary key(sid);

删除索引:

    alter table c_table drop index c_n1;

更改列信息:

    alter  table t_table change c_1 c_1 varchar(200);
    alter table t_table modify 1 c_1 varchar(200);

insert插入语句:

    insert into table_name (c_1,c_2)
        values ('x1',1);

update语句:

    update  table_name set c_1 =1 where c_2=3;

删除数据库或者表:

    drop table table_name;
    drop database database_name;//使用mysql_drop_db()可以删除的.