SQL 視頻整體總結,sql整體總結

來源:互聯網
上載者:User

SQL 視頻整體總結,sql整體總結

還是喜歡英語7,8分鐘的短視頻,陳偉老師的VB視頻,耿建玲老師的SQL視頻,都是在30-40分鐘之間,一個番茄不夠用,兩個番茄用不完。不過還好,無論是陳偉老師的VB視頻,還是耿建玲老師的SQLServer視頻,其中的資訊量都是很大的,看完後能學到很多知識。畫個圖,整理一下視頻中的知識。


視頻中主要介紹SQL Server的知識和SQL Server2000的使用方法。

 

從軟體出發:

主要是講了用企業管理器和T-sql語句對資料庫,資料庫物件等其他相關的進行下面的操作操作

  1. 建立
  2. 查看和修改
  3. 刪除
  4. 重新命名

對資料庫和資料庫物件的概念進行了介紹,對他們進行操作

  1. 資料庫

有固定的系統資料庫

系統資料表

  1. 資料對象

資料庫物件就是軟體開啟時,在資料庫下面我們可以看到的,有表,視圖,觸發器,預存程序,規則,索引,角色等。

  1. 資料庫檔案

主要檔案,次要檔案,記錄檔。及他們在資料庫中的意義

 

從語言出發,語言是相同的,很多跟VB的語言是類似的。

  1. 資料類型   
  1. 函數
  1. 遊標
  2. 流程式控制制
  3. 變數

 

視頻中著重講了,用企業管理器和t-sql語句對資料庫,視圖,表,角色,預存程序,索引,觸發器的操作。通過例子深入瞭解T-sql語句對這些的操作。

還講了事務的概念和在資料處理中的作用,約束的概念和建立的方法。

索引,觸發器,預存程序,約束的講解講的也比較詳細

 

  1. 企業管理器在SQL Server2008中沒有了,代之的是SQL Server manger studio 操作上有一點不同,有的找不到,百度後找到了相關的項。
  2. T-sql的代碼是通用的
    SQLServer入門經典,看的是模模糊糊,不過視頻,給了很好的知識講解,學習的知識都是相互聯絡的,自考課本的資料庫系統原理在看完視頻後,第五章之後的知識基本上也就解決了,把知識聯絡起來,需要學習的知識漸漸的少了,效率提高了。

SQL 陳述式總結

1、說明:建立資料庫
CREATE DATABASE database-name
2、說明:刪除資料庫
drop database dbname
3、說明:備份sql server
--- 建立 備份資料的 device
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
--- 開始 備份
BACKUP DATABASE pubs TO testBack
4、說明:建立新表
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)
根據已有的表建立新表:
A:create table tab_new like tab_old (使用舊錶建立新表)
B:create table tab_new as select col1,col2… from tab_old definition only
5、說明:刪除新表
drop table tabname
6、說明:增加一個列
Alter table tabname add column col type
註:列增加後將不能刪除。DB2中列加上後資料類型也不能改變,唯一能改變的是增加varchar類型的長度。
7、說明:添加主鍵: Alter table tabname add primary key(col)
說明:刪除主鍵: Alter table tabname drop primary key(col)
8、說明:建立索引:create [unique] index idxname on tabname(col….)
刪除索引:drop index idxname
註:索引是不可更改的,想更改必須刪除重建立。
9、說明:建立視圖:create view viewname as select statement
刪除視圖:drop view viewname
10、說明:幾個簡單的基本的sql語句
選擇:select * from table1 where 範圍
插入:insert into table1(field1,field2) values(value1,value2)
刪除:delete from table1 where 範圍
更新:update table1 set field1=value1 where 範圍
尋找:select * from table1 where field1 like ’%value1%’ ---like的文法很精妙,查資料!
排序:select * from table1 order by field1,field2 [desc]
總數:select count as totalcount from table1
求和:select sum(field1) as sumvalue from table1
平均:select avg(field1) as avgvalue from table1
最大:select max(field1) as maxvalue from table1
最小:select min(field1) as minvalue from table1
11、說明:幾個進階查詢運算詞
A: UNION 運算子
UNION 運算子通過組......餘下全文>>
 
SQL常用的語句的總結

資料庫常用動作陳述式:
1、說明:建立資料庫
CREATE DATABASE database-name
2、說明:刪除資料庫
drop database dbname
3、說明:備份sql server
--- 建立 備份資料的 device
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
--- 開始 備份
BACKUP DATABASE pubs TO testBack
4、說明:建立新表
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)
根據已有的表建立新表:
A:create table tab_new like tab_old (使用舊錶建立新表)
B:create table tab_new as select col1,col2… from tab_old definition only
5、說明:刪除新表
drop table tabname
6、說明:增加一個列
Alter table tabname add column col type
註:列增加後將不能刪除。DB2中列加上後資料類型也不能改變,唯一能改變的是增加varchar類型的長度。
7、說明:添加主鍵: Alter table tabname add primary key(col)
說明:刪除主鍵: Alter table tabname drop primary key(col)
8、說明:建立索引:create [unique] index idxname on tabname(col….)
刪除索引:drop index idxname
註:索引是不可更改的,想更改必須刪除重建立。
9、說明:建立視圖:create view viewname as select statement
刪除視圖:drop view viewname
10、說明:幾個簡單的基本的sql語句
選擇:select * from table1 where 範圍
插入:insert into table1(field1,field2) values(value1,value2)
刪除:delete from table1 where 範圍
更新:update table1 set field1=value1 where 範圍
尋找:select * from table1 where field1 like ’%value1%’ ---like的文法很精妙,查資料!
排序:select * from table1 order by field1,field2 [desc]
總數:select count as totalcount from table1
求和:select sum(field1) as sumvalue from table1
平均:select avg(field1) as avgvalue from table1
最大:select max(field1) as maxvalue from table1
最小:select min(field1) as minvalue from table1
11、說明:幾個進階查詢運算詞
A: UNION 運算子
U......餘下全文>>
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.