以前web server 一天服務三千人可以正常執行,如果一天來三十萬人次那web server 一定會忙線然後lag、當機(畫面不會動但是系統正在消化這三十萬人次的資料量),如果要公司添購滿足這樣需求的機器勢必會加大公司對it部門的預算,俗話說"想喝牛奶,不用真的養一頭牛在家裡",去路口的便利超商買就好了,何況就算買了以後機器負載可能90%都在低負載,這就是一種資源浪費,如果要應付突然的大量的使用量時,在it世界裡以前沒有解決方案但是現在有了---那就是雲端。
1.查資料庫是否存在? select * from sysdatabases where sid> 0x01 可以找出自訂的資料庫系統的我們就跳過吧 2.查資料庫裡的所有資料表? use TestReport; --選擇你要查的資料庫 select TABLE_NAME from INFORMATION_SCHEMA.TABLES; go 3. 查資料表的欄位定義 use TestReport; select * from INFORMATION_SCHEMA.COLUMNS ; go
那我們來熱身一下吧
首先我先畫一下windows form的草稿gui 大概是長這樣 實際是長這樣 code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient;
namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
範例: Declare @day1 date Declare @day2 date declare @day3 int set @day1='2009-04-20' set @day2='2009-04-27' select @day3=DATEDIFF(DD,@day1,@day2) select @day3 ---------------------------------------------- 7
資料庫 :AdventureWorks sql2008 範例資料庫 一年前我去面試得時候 ,那時我還不知道between用法的時候 , 在sql裡面查詢某一個資料行的區間範圍時我們用 select * from HumanResources.Employee where BirthDate >='1972-05-15' And BirthDate <='1977-05-15' 所謂的區間值其實本身已經隱含排序的味道,比如說日期, 真實數字 所以才有區間的感覺 在between 的語法下: where 資料行1 between A and B PS:A必須要小於B
select * from HumanResources.Employee where BirthDateBetween '1972-05-15' and '1977-05-15' 所以這樣是不是簡單多了呢