close

參考資料來源 w3school: https://www.w3schools.com/sql/default.asp

  1.  SELECT 欄位 FROM 資料表 (查詢資料)
    SELECT * FROM Customers;
    SELECT CustomerID FROM Customers;
     
  2.  SELECT DISTINCT 欄位 FROM 資料表 (查詢不重複出現資料內容與數量) 
    SELECT DISTINCT Country FROM Customers; 
    查詢Customers資料表中的Country欄位中有幾個國家,不重複出現,會給統計數量,會給資料
     
  3.  SELECT COUNT( DISTINCT Country) FROM Customers; (查詢不重複出現資料數量) 
    SELECT COUNT (DISTINCT Country) FROM Customers; 
    查詢Customers資料表中的Country欄位中有幾個國家,不重複出現,只給統計資料,不給資料
arrow
arrow
    全站熱搜

    xXx 發表在 痞客邦 留言(0) 人氣()