標籤:測試環境:windows7 64位 mysql.exe、Navicat Lite for MySQL、mysql 5.0.18mysql資料庫的結構:資料庫(database)包含多個表(table);表包含多個屬性列(column);屬性列包含多個資料(data);屬性列具有四個資訊(field,type,null,key,default)。我們要做得工作就是對database、table、column、data進行增、刪、改、查四種操作,一共4*4=16種命令。 1.1 增
標籤: 將4月20到目前時間段的銷售狀態全部改成未售(1),銷售時間改成null(0)UPDATE hy_car_detail hcd SET hcd.sales_date = ‘‘,hcd.sales_status = ‘1‘ WHERE hcd.car_id IN ( SELECT hc.car_id FROM hy_car hc WHERE hc.car_date BETWEEN (SELECT UNIX_TIMESTAMP (‘2016-04-20 00:00:00‘
標籤:character mysql 中文 my.cnf[client] default-character-set=utf8[mysqld] character_set_server=utf8 (5.6版本為這個格式,5.5以前的版本據說是另外的格式)mysql> show variables like ‘coll%‘;+----------------------+
標籤:1.普通查詢select * from info; #查詢所有內容select Code,Name from Info #查詢某幾列2.條件查詢select * from Info where Code=‘p001‘ #條件查詢select * from Info where Nation =‘n001‘ and Sex= true #條件之間並的關係select * from Info where Nation = ‘n001‘ and sex = ‘1‘select * from
標籤:進階查詢1.串連查詢(對列的擴充)第一種形式select * from Info,Nation #會形成笛卡爾積select * from Info,Nation where Info.Nation = Nation.Code #加入篩選條件select Info.Code,Info.Name,Sex,Nation.Name from Info,Nation where Info.Nation = Nation.Code#查詢指定列select Info.Code as
標籤:#1預存程序create procedure greeting()BEGIN # 77 = 16 FOR username + 60 for hostname + 1 for ‘@‘DECLARE user CHAR(77) CHARACTER SET utf8;SET user = (SELECT CURRENT_USER());IF INSTER(user, ‘@‘) > 0 THENSET user = SUBSTRING_INDEX(user, ‘@‘,1);END IF;
標籤:首頁面代碼:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><style>.liu{
標籤:Vagrant搭建(Tomcat8+JDK7+MySQL5+dubbo)JDK1.下載jdk2.解壓JDKtar -xzvf jdk-7u79-linux-x64.tar.gz 3.設定環境變數vim /home/vagrant/.bashrc 這裡因為我用的vagrant所以提示: The program ‘vim‘ can be found in the following packages:* vim* vim-gnome* vim-tiny* vim-athena* vim-
標籤:背景:由於單表的資料記錄高達了一百萬條,造成資料訪問很慢,Google分析的後台經常報告逾時,尤其是頁碼大的頁面更是慢的不行。測試環境:先讓我們熟悉下基本的sql語句,來查看下我們將要測試表的基本資料use infomation_schemaSELECT * FROM TABLES WHERE TABLE_SCHEMA = ‘dbname’ AND TABLE_NAME = ‘product’查詢結果:從中我們可以看到表的基本資料:表行數:8