牛客挑戰賽46 C
阿新 • • 發佈:2020-12-15
文章來源:https://www.cnblogs.com/geaozhang/p/6797357.html
50G:1500萬條記錄 # mysql使用:https://www.cnblogs.com/-wenli/p/10352746.html # 建立資料庫 myWeb CREATE DATABASE myWeb; # 建立資料表 person (改表中有4個欄位,id,name,email,password) CREATE TABLE person(id int(10),name char(20),email char(40),password char(20)); # 從person中刪除資料 delete from person where password="KTF"; # 顯示支援的字符集 show variables like '%char%'; # 將某個欄位設定為gbk alter table person modify name char(20) character set gbk; # 建立資料庫 create table person(id int PRIMARY KEY AUTO_INCREMENT,name varchar(20) NOT NULL,email varchar(50) NOT NULL,password varchar(50) NOT NULL); # 建立自增表 # 刪除資料表 drop table person # 插入資料到person中 INSERT INTO person(name,email,password) VALUES("張三","[email protected]","Zs"); INSERT INTO person(name,email,password) VALUES("李四","[email protected]","Ls"); INSERT INTO person(name,email,password) VALUES("王二","[email protected]","We"); INSERT INTO person(name,email,password) VALUES("麻子","[email protected]","Mz"); # mysql建立儲存過程 delimiter $ create procedure test_person(in num char(20)) begin declare i int default 6; while i <= num do INSERT INTO person VALUES(i,"康廷峰","[email protected]","KTF"); set i = i+1; end while; end $ set @num=20; #呼叫儲存過程 call test_person(@num); # 刪除儲存過程 drop procedure name; 注意: mysql關鍵字必須用:`name` 否則mysql會將其判斷其為一個函式,提示欄位錯誤; //如下欄位 INSERT INTO alarms (action_id,rule_id,happentime,hostname,sip,sport,dip,dport,unique_id,msg_id,`match`,severity_id,tag_id,user_agent,`url`,url_hash,method,post,response_code,request_header,response_header,response_body,country,province,city) values (1,11060006, "2020-12-14 18:35:04","10.20.185.111","10.20.89.119",62394,"10.50.36.222",8002,"6906058750556110861",11060,".mdb",2,1106,"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0","10.20.185.111/1.mdb","e70dcc69844a7ab11a3183103739d8ca","GET","",403,"GET /1.mdb HTTP/1.1Host: 10.20.185.111User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2Accept-Encoding: gzip, deflateUpgrade-Insecure-Requests: 1Cache-Control: max-age=0","HTTP/1.1 403","","LAN","",""); -------------------------- delimiter $ create procedure test_person(in num char(20)) begin DECLARE rep_body text DEFAULT 'AASDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFQWERQWEROHJKJ2435583O47582934HKSDNJF93445345abcdefghijklmnopqrstuvwxyzABCDEFJHIJKLMNOPQRSTUVWXYZ'; declare i int default 1; while i <= num do INSERT INTO alarms (action_id,rule_id,happentime,hostname,sip,sport,dip,dport,unique_id,msg_id,`match`,severity_id,tag_id,user_agent,`url`,url_hash,method,post,response_code,request_header,response_header,response_body,country,province,city) values (1,11060006, "2020-12-14 18:35:04","10.20.185.111","10.20.89.119",62394,"10.50.36.222",8002,"6906058750556110861",11060,".mdb",2,1106,"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0","10.20.185.111/1.mdb","e70dcc69844a7ab11a3183103739d8ca","GET","",403,"GET /1.mdb HTTP/1.1Host: 10.20.185.111User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2Accept-Encoding: gzip, deflateUpgrade-Insecure-Requests: 1Cache-Control: max-age=0","HTTP/1.1 403",rep_body,"LAN","",""); set i = i+1; end while; end $ set @num=20; #呼叫儲存過程 call test_person(@num);