close

前陣子 賢爸 去台北上了兩天的課程 有關 T-SQL的使用 把上課內容記錄了下來

跟大家一起分享

新增資料庫 查詢資料庫內容:

======== 新增 db01 資料庫   和 cust table ======== 

create database db01

create table cust(

custid int,

custname nvarchar(10))

======== Insert 資料 ======== 

Insert Into cust(custid, custname)

Values(1001, 'joson'),

(1002, 'bill'),

(1003, 'john'),

(1004, 'kelly')

======== 列出結果 ======== 

Select * From Cust

Select CustId, CustName --選取CustId, CustName

From Cust

======== 使用別名列出欄位名稱 ======== 

Select c.CustId as [''] ,c.CustName as CustomerName

From Cust c

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 賢爸 的頭像
    賢爸

    賢爸知識分享站

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