要順便記錄資料加入的時間,所以你要新增一個欄位,欄位名稱隨你取
但是記得欄位格式要設為"datetime"
痞客興 發表在 痞客邦 留言(0) 人氣(2,166)
在5.1版MySQL伺服器中提供了視圖功能(包括可更新視圖)。
本章討論了下述主題:
· 使用CREATE VIEW或ALTER VIEW建立或更改視圖。
· 使用DROP VIEW銷毀視圖。
痞客興 發表在 痞客邦 留言(0) 人氣(7,074)
select * from customers where customerid = '1'
select * from orderdetails group by productid
select productid,
sum(quantity) as s_qty,
avg(quantity) as a_qty,
max(quantity) as max_qty,
min(quantity) as min_qty,
count(quantity) as c_qty
from orderdetails group by productid
痞客興 發表在 痞客邦 留言(0) 人氣(234)
你可以利用MySQL的排序的功能,再select資料
比如說下面的指令使用 order by dtime desc,dtime是我資料庫中日期的欄位
再使用limit 1來取出第一筆,這時的第一筆其實是我資料庫中的最後最新的一筆資料.
痞客興 發表在 痞客邦 留言(0) 人氣(21,990)
1.進入phpMyAdmin,左邊資料庫列表先點選你要複製的資料庫.
2.上方工具列點選"操作".
3.你會看到"複製數據庫到"區塊,點選"結構和數據",並勾選"複製前創建數據庫(CREATE DATABASE)",並勾選"添加自增(AUTO INCREMENT)值"後按"執行"
4.驗收新資料庫
痞客興 發表在 痞客邦 留言(0) 人氣(2,189)
列出某個資料庫內所有table的更新時間
SELECT TABLE_NAME,UPDATE_TIME FROM information_schema.tables where TABLE_SCHEMA='database_name';
列出所有資料庫內所有tables的更新時間
SELECT table_schema,TABLE_NAME,UPDATE_TIME FROM information_schema.tables;
痞客興 發表在 痞客邦 留言(0) 人氣(683)
來源:http://jingyan.baidu.com/article/948f5924259516d80ef5f95e.html
1.mysqldump的幾種常用方法:
(1)匯出整個資料庫(包括資料庫中的資料)
痞客興 發表在 痞客邦 留言(0) 人氣(27,752)
mysqlcheck -a -c -o -r -m --all-databases -uroot -p
即可最佳化所有db
參數含意:
-a = Analyse given tables.
-c = Check table for errors
-o = Optimise table
-r = Can fix almost anything except unique keys that aren't unique
-m = --medium-check
痞客興 發表在 痞客邦 留言(0) 人氣(1,566)