Home >php教程 >php手册 >mysql常识和基本操作

mysql常识和基本操作

WBOY
WBOYOriginal
2016-06-13 10:05:46731browse

字段类型
   1.INT[(M)]
   正常大小整数类型
   2.DOUBLE[(M,D)] [ZEROFILL]
   正常大小(双精密)浮点数字类型
   3.DATE
   日期类型。支持的范围是'1000-01-01'到'9999-12-31'。MySQL以'YYYY-MM-DD'格式来显示DATE值,但是允许你使用字符串或数字把值赋给DATE列
   4.CHAR(M)
   定长字符串类型,当存储时,总是是用空格填满右边到指定的长度
   5.BLOB TEXT
   BLOB或TEXT类型,最大长度为65535(2^16-1)个字符。
   6.VARCHAR
   变长字符串类型。
 
   1: 显示数据库
 
   SHOW DATABAS,
   2:当前选择的数据库,
   mysql> SELECT DATABASE();
   ------------
   | DATABASE() |
   ------------
   | test ;
   ------------
   | DATABASE() |
   ------------
   | test    |
   ------------
   当前数据库包含的表信息:
   mysql> SHOW TABLES;
   ---------------------
   | Tables in test 
   mysql> SHOW TABLES;
   ---------------------
   | Tables in test   |
   ---------------------
   | mytable1      |
   | mytable2      |
   ---------------------
   获取表结构
   mysql> desc mytable1;
   --------- ------------- ------ ----- --------- -------
   | Field  mysql> desc mytable1;
   --------- ------------- ------ ----- --------- -------
   | Field  | Type  | Null | Key | Default | Extra |
   --------- ------------- ------ ----- --------- -------
   | s1  | varchar(20) | YES |NULL  |    |
   --------------------- ------ ----- --------- -------
   5.导入数据库表
   (1)创建.sql文件
   (2)先产生一个库如auction.c:mysqlbin>mysqladmin -u root -p creat auction,会提示输入密码,然后成功创建。
   (2)导入auction.sql文件

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn