SQL用途廣泛,可能大家工作上亦有應用到,大家可以係Microsoft EXCEL, ACCESS 以SQL連接各資料庫,再進一步可以用ORACEL產品SQL Developer或 @oflyhigh 哥 介紹過的pymssql,詳情可看第一次使用STEEMSQL查询谷哥点名数据。 今天先談怎樣在EXCEL連接STEEMSQL和一些基本SQL語法,希望大家有機會可應用在工作/功課上。
There are widely use for SQL in daily work, we can use Microsoft EXCEL, ACCESS to connect database through SQL, we also can use ORACLE SQL developer or pymssql that introduced by @oflyhigh before, the detail we can see 第一次使用STEEMSQL查询谷哥点名数据. Today, i want to introduce how to use SQL in EXCEL and some basic SQL statement.
Step 1: We can click the 「Data」button.
Step 2: Then click the 「From Other Sources」, and 「From Microsoft Query」
Step 3: Click 「Data Source」.
Step 4: Click「Data Source Name」and Type 「DBSteem」, select 「SQL Server」.
Step 5: Click 「Conncet」.
伺務器: sql.steemsql.com
登入識別碼: steemit
密碼: steemit
Step 6: Enter Server , User, Password and then dont choose the default spreadsheet.
Server: sql.steemsql.com
User: steemit
Password: steemit
Step 7: We can see the data source「DBSteem」and click enter.
Accounts
Comments
我們先選Comments
Step 8: We can see many tables, in general, we always use
Accounts
Comments
Now we choose Comments table
Step 9: We dont choose filter and sorting function and choose 「Microsoft Query」.
Step 10: We click the 「SQL」button on the left top hand-side and type the SQL statement.
SELECT Comments.title
FROM DBSteem.dbo.Comments Comments
WHERE author='ryanfan11' AND title like '%Learning %'
Step 11: Now we type the 「Learning」in the where condition in SQL statement and I will explain as below.
齊來學習系列#1 齊來學密碼管理器 : LassPass| Learning Password Manager Together: LassPass
齊來學習系列#2 齊來學WWW | Learning World-Wide-Web Together
如想匯出EXCEL,按左上「將資料傳回EXCEL」的按鈕
Step 12: The result is shown.
Step 13: Choose 「spreadsheet」and enter.
The result is exported to EXCEL.現在簡單講述一下SQL的組成部分 SELECT: 選擇你想要的欄位(Column) FROM : 由那一個表抽取資料 WHERE: 條件 Like: 依據一個模式 (pattern) 上面SELECT Comments.title FROM DBSteem.dbo.Comments Comments WHERE author='ryanfan11' AND title like '%Learning %' 代表由Comments表中選擇title 這欄位,並只選擇作者是ryanfan11和title 內有Learning的字眼
Now, i will explain the SQL statement SELECT: Choose the column you want FROM : Choose the retrieved data table WHERE: Condition Like: Pattern Form the SQL statement, SELECT Comments.title FROM DBSteem.dbo.Comments Comments WHERE author='ryanfan11' AND title like '%Learning %' represent we want choose column "title "in table comments and we want only choose the author is "ryanfan11" and the title contain "Learning"希望大家睇完今次文章,可以知道如何在EXCEL中使用SQL去查詢,包括查詢自己在STEEM的資料。
After reading the post, hope you guys can know how to use SQL to connect database in EXCEL just like read the STEEM data in databases.PS: 特別感谢
Special thanks for@arcange provide the SteemSQL service for us to retrieve STEEM data .
過往的齊來學習系列
齊來學習系列#1 齊來學密碼管理器
齊來學習系列#2 齊來學WWW