零基礎 SQL 資料庫小白,從入門到精通的學習路線與書單

一,學SQL的苦惱

二,SQL 的原理

三,SQL 的數學基礎

四,SQL基礎問題

Students:

Create Table dbo.Students(
StudentId Varchar(10),
Name Nvarchar(200),
Gender Nvarchar(1),
Height Numeric(4,1),
Mustache Varchar(3),
SkinColor Nvarchar(1)
);
Relationships:

Create Table dbo.Relationships(
RelationshipId Int,
BoyId Varchar(10),
GirlId Varchar(10),
BeginDate Datetime,
CurrentActive Varchar(1),
EndDate Datetime
);

五,線上執行SQL工具

INSERT INTO Students(
StudentId,
Name,
Gender,
Height,
Mustache,
SkinColor
)
Values
('001',N'陈冠奇',N'男',186,'No',N'白'),
('002',N'谢堂风',N'男',182,'No',N'白'),
('003',N'黄博',N'男',176,'Yes',N'黑'),
('004',N'李少杰',N'男',172,'Yes',N'黑'),
('005',N'徐少斌',N'男',163,'No',N'黑'),
('006',N'张白芷',N'女',172,'No',N'白'),
('007',N'张少函',N'女',163,'No',N'白'),
('008',N'灵昆',N'女',181,'No',N'黑'),
('009',N'夏平',N'女',158,'No',N'白'),
('010',N'莫文丽',N'女',156,'No',N'白')
INSERT INTO Relationships(
RelationshipId,
BoyId,
GirlId,
BeginDate,
CurrentActive,
EndDate
)
Values
(1001,'001','006','2002-04-01','Y',null),
(1002,'003','009','2001-04-01','Y',null),
(1003,'005','010','2003-04-01','N','2004-04-01'),
(1004,'002','010','2004-04-01','N','2004-05-01'),
(1005,'004','010','2004-05-01','N','2005-08-01')
SELECT Name
FROM Students
WHERE Height > 180 and Gender = N'男'
SELECT Name 
FROM Students
WHERE Height> 170 and SkinColor = N'白' and Gender = N'女'
SELECT Name
FROM Students
WHERE Height = (SELECT MAX(Height) FROM Students WHERE Gender = N’女’ )
and Gender = N’女’
SELECT Boy.Name as BoyName,
Girl.Name AS GirlName
FROM Relationships Rel
INNER JOIN Students Boy on Rel.BoyId = Boy.StudentId
INNER JOIN Students Girl on Rel.GirlId = Girl.StudentId
UPDATE Students 
SET Mustache = ‘Yes’
WHERE Name = N’陳冠奇’
UPDATE Relationships
SET CurrentActive = ‘N’,
EndDate = ‘2008–04–01’
WHERE BoyId = (SELECT StudentId FROM Students WHERE Name = N’陳冠奇’) AND
GirlId = (SELECT StudentId FROM Students WHERE Name = N’張白芷’)
DELETE Students 
WHERE Name = N’張白芷’
INSERT INTO Relationships(
RelationshipId,
BoyId,
GirlId,
BeginDate,
CurrentActive,
EndDate
)
Values
(1006,’001',’010',’2008–04–01',’Y’,null)
SELECT RelationshipId 
FROM Relationships
WHERE GirlId = (SELECT StudentId FROM Students WHERE Name = N’莫文麗’)

七,SQL 晉級分水嶺

八,SQL 資料庫深入學習

九,SQL 人的職業生涯

十,SQL 資料庫必讀書單

文章推薦

這是一個專注於數據分析職場的內容部落格,聚焦一批數據分析愛好者,在這裡,我會分享數據分析相關知識點推送、(工具/書籍)等推薦、職場心得、熱點資訊剖析以及資源大盤點,希望同樣熱愛數據的我們一同進步! 臉書會有更多互動喔:https://www.facebook.com/shujvfenxi/

這是一個專注於數據分析職場的內容部落格,聚焦一批數據分析愛好者,在這裡,我會分享數據分析相關知識點推送、(工具/書籍)等推薦、職場心得、熱點資訊剖析以及資源大盤點,希望同樣熱愛數據的我們一同進步! 臉書會有更多互動喔:https://www.facebook.com/shujvfenxi/