国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > MySQL > 正文

mysql database manual(mysql數(shù)據(jù)庫手冊(cè))

2024-07-24 12:44:11
字體:
供稿:網(wǎng)友
2.1登入到mysql控制臺(tái)[用戶名為root,密碼缺省為空]
切換到mysql的bin目錄cd d:/wamp/mysql/bin
登入到mysql控制臺(tái)
語法:mysql -h hostname -u username -p
連接到另一臺(tái)主機(jī)
代碼:mysql -h 192.168.1.1 -u root -p
password:直接按回車
連接到本機(jī)
代碼:mysql -h 127.0.0.1 -u root -p
password:直接按回車
出現(xiàn)mysql>表示登陸到mysql控制臺(tái)成功
2.2退出mysql控制臺(tái)
mysql>exit;
/***********************************************************/
3.1檢查所有mysql數(shù)據(jù)庫清單;
語法:mysql> show databases;
代碼:mysql> show databases;

3.2顯示數(shù)據(jù)庫中所有表的清單
查看當(dāng)前數(shù)據(jù)庫中的表
語法1:mysql> show tables;
代碼1:mysql> show tables;

3.3查看其它數(shù)據(jù)庫jxc中的表
語法1:mysql> show tables from databasename;
代碼1:mysql> show tables from jxc;
/***********************************************************/
4.創(chuàng)建/刪除/選擇數(shù)據(jù)庫
創(chuàng)建jxc數(shù)據(jù)庫:
語法:mysql> create database databasename;
代碼:mysql> create database jxc;
刪除jxc數(shù)據(jù)庫:
語法:mysql> drop database databasename;
代碼:mysql> create database abc;
代碼:mysql> drop database abc;
選擇jxc數(shù)據(jù)庫:
語法:mysql> use database;
代碼:mysql> use jxc;
/***********************************************************/

5查看一個(gè)表的數(shù)據(jù)結(jié)構(gòu)
5.1 describte查看表customers結(jié)構(gòu)
語法1:mysql> describe tablename;
代碼1:mysql> describe customers;
5.2.show columns查看表customers;結(jié)構(gòu)
語法1:mysql> show columns from tablename;
代碼1:mysql> show columns from customers;

5.3.查看一個(gè)表的指定列名的數(shù)據(jù)結(jié)構(gòu)
語法1:mysql> show index from tablename column;
代碼1:mysql> show index from customers name;

5.4.查看一個(gè)表customers的索引
語法1:mysql> show index from tablename;
代碼1:mysql> show index from customers;

6.數(shù)據(jù)常用操作(select,insert,update,delete)
6.1 select選擇:
語法:select * from [表名1,表名1,,,] where [條件范圍]
代碼:select * from orders where orderid>100;

6.2 insert插入
語法:insert into table1(column1,column,,,) values(value1,value2,,,);
代碼:insert into books(isbn,author,title,price) values('iso-902126','jahn.D','mysql6.0',99.0);

6.3 update 更新:
語法:update table1 set [列名]=[新數(shù)據(jù)] where [條件范圍]
代碼:update books set title="Thinking in Java" where isbn='iso-902126';

6.4刪除:
語法:delete from [表名] where [條件范圍]
代碼:delete from books where isbn='iso-902126';

6.5其它方法
查找:select * from table1 where field1 like '%value1%' ---like的語法很精妙
排序:select * from table1 order by field1,field2 [desc]
總數(shù):select count as totalcount from table1
求和:select sum(field1) as sumvalue from table1
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 绵竹市| 光山县| 汉源县| 察哈| 慈利县| 永靖县| 娱乐| 武穴市| 曲松县| 黄浦区| 德州市| 纳雍县| 库尔勒市| 云林县| 永兴县| 崇左市| 如东县| 靖州| 渭源县| 固镇县| 灵山县| 托克逊县| 县级市| 博白县| 南宫市| 喀喇沁旗| 大城县| 卓资县| 齐齐哈尔市| 宜君县| 九台市| 石屏县| 兴文县| 高州市| 甘南县| 南阳市| 丽水市| 景德镇市| 招远市| 通海县| 仪陇县|