基本MySQL命令

2021-08-10 15:46:53 字數 1531 閱讀 1159

pythonwindows下中文目錄:

link_filepath.decode('utf8').encode('gbk')

1.怎樣將資料表自增id重新歸零?

mysql> truncate table 表名;

2.在router資料中使用:

select count(country) from routergeoinfo where country='us';

select count(country) from routergeoinfo where country='cn' and city='***';

select country,count(*) from routergeoinfo group by country;

select country,count(*) from routergeoinfo group by country order by count(*) desc;

select count(*),organization,geolocation,ip_type from prefixinfo  group by organization,geolocation,ip_type;

3.將查詢資料重新插入新錶中

insert into 201603_asorder(as_number,count)select count(*),as_number from 201603_routerasinfo group by as_number;

insert into 4134routergeo(router_id,continent,country,region,city,latitude,longitude) (select router_id,continent,country,region,city,latitude,longitude from routergeoinfo where router_id in (select router_id from routerasinfo where as_number = '4134'));

4.將篩選出的資料按照某一列進行求和

select count(*),sum(number),organization,geolocation,ip_type from prefixinfo  group by organization,geolocation,ip_type;

select sum(temp1.number) from (select number from prefixinfo where organization in 'ec2'and ip_type='ipv4')  as temp1; 5.

alibaba關係篩選:

select* from as_rel_cn where source in (37963,45096.45102,45103,45104,59028,59051,59052,59053,59054,59054,59055,134963) or destination in (37963,45096.45102,45103,45104,59028,59051,59052,59053,59054,59054,59055,134963);

mysql基本命令總結 mysql基本命令總結

1.在ubuntu上安裝mysql sudo apt get install mysql server sudo apt get install mysql client 2.安裝結束後,用命令驗證是否安裝並啟動成功 sudo netstat tap grep mysql 通過上述命令檢查之後,如果...

mysql配置命令 MySQL基本配置命令總結

建立資料庫 create databse 資料庫名稱 顯示mysql中的資料庫 show databases 進入資料庫 use 資料庫名稱 顯示資料庫中的表 show tables 顯示表結構 desc 表名稱 批量執行sql指令碼 d test.sql 備份資料庫,可以到命令列下,執行如下命令 ...

mysql基本命令

第一招 mysql服務的啟動和停止 net stop mysql net start mysql 第二招 登陸mysql 語法如下 mysql u使用者名稱 p使用者密碼 鍵入命令mysql uroot p,回車後提示你輸入密碼,輸入12345,然後回車即可進入到mysql中了,mysql的提示符是...