回覆列表
  • 1 # 使用者5462145998420

    1、選中需要測試的資料庫,並檢視測試資料庫表;由於表t_people_info中的id是主鍵,求id的個數即是求資料庫表的總記錄數,程式碼如下:select count(id) from t_people_info;

    2、檢視資料庫表t_people_info中年齡中最小值,需要用到集合函式min(),程式碼如下:select min(p_age) from t_people_info;

    3、檢視資料庫表t_people_info中年齡中最大值,需要用到集合函式max(),程式碼如下:select max(p_age) from t_people_info;

    4、檢視資料庫表t_people_info中年齡中平均值,需要用到集合函式avg(),程式碼如下:select avg(p_age) from t_people_info;

    5、若想統計t_people_info中的年齡的總和,用到集合函式sum(),程式碼如下:select sum(p_age) from t_people_info;

    6、統計資料庫表中記錄個數,除了使用count(主鍵)外,可以使用count(1)、count(*)和count(0),程式碼如下:select count(1) from t_people_info;select count(*) from t_people_info;select count(0) from t_people_info;

  • 中秋節和大豐收的關聯?
  • SFS是什麼意思?