SSMS For Beginner Part 1 to 10

Part 1 Connecting to SQL Server using SSMS

note that,SSMS is a client tool and not the server by itself,it is a developer machines connects to SQL Server.

Part 2 Creating altering and dropping a database

you cannot drop a database , if it is currently in use you will get an error stating. so , if other users are connected, you need to put the database in single user node and then drop the database.system database cannot be dropped.

Part 3 Creating and working with tables

for example:add a foreignkey relation.

table:Student:ID,GenderID;

Gender:ID,StudentID;

Alter table Student Add Constraint Student_GenderID_FK
FOREIGN KEY (GenderID) references Gender (ID)

Syntax :

Alter table 外键表名 add constraint 外键约束名

FOREIGN KEY (外键名) references 主表名 (主键名)

Note:Foreign Keys are used to enforce(强制) database integrity(完整) . In layman‘s terms(一般来说), A foreign key in one table points to a primary key in another table. The foreign key constraint prevents invalid data form being inserted into the foreign key column. The values that you enter into the foreign key column, has to be one of the values contained in the table it points to.

Part 4 Adding a default constraint

Altering an existing column to add a default constraint:

ALTER TABLE 表名

ADD CONSTRAINT 约束名

DEFAULT 默认值 FOR 列名

Adding a new column with default value, to an existing table:

ALTER TABLE 表名

ADD 列名 数据类型 是否允许null

CONSTRAINT 约束名 DEFAULT 默认值

Dropping a constraint:

ALTER TABLE 表名

DROP CONSTRAINT 约束名

Part 5 Cascading referential integrity constraint

 Part 6 Adding a check constraint

Part 7 Identity Column in SQL Server

Part 8 How to get the last generated identity column value in SQL Server

Part 9 Unique key constraint

Part 10 Select statement in sql server

Select specific or all columns

select * from 表名

select 列名,列名... from 表名

Distinct rows

select distinct 列名 from 表名

Filtering with where clause(子句)

Wild Cards in SQL Server

Joining multiple conditions using AND and OR operators

Sorting rows using order by

Selecting top n or top n percentage of rows

时间: 2024-08-01 16:44:42

SSMS For Beginner Part 1 to 10的相关文章

SSMS For Beginner Part 34

Part 34 Temporary tables in SQL Server

SSMS For Beginner Part 28 to 33

Part 28 Cast and Convert functions in SQL Server Part 29 Mathematical functions in sql server Part 30 Scalar user defined functions in sql server Part 31 Inline table valued functions in sql server Part 32 Multi statement table valued functions in sq

SSMS For Beginner Part 18 to 21

Part 18 Stored procedures in sql server Part 19 Stored procedures with output parameters Part 20 Stored procedure output parameters or return values Part 21 Advantages of stored procedures

SSMS For Beginner Part 22 to 24

Part 22 Built in string functions in sql server 2008 Part 23 LEFT, RIGHT, CHARINDEX and SUBSTRING functions in sql server Part 24 Replicate, Space, Patindex, Replace and Stuff string functions in sql server 2008

SSMS For Beginner Part 25 to 27

Part 25 DateTime functions in SQL Server Part 26 IsDate, Day, Month, Year and DateName DateTime functions in SQL Server Part 27 DatePart, DateAdd and DateDiff functions in SQL Server

[我给Unity官方视频教程做中文字幕]beginner Graphics – Lessons系列之摄像机介绍Cameras

[我给Unity官方视频教程做中文字幕]beginner Graphics – Lessons系列之摄像机介绍Cameras 最近得到一些Unity官方视频教程,一看全是纯英文的讲解,没有任何字幕或者讲稿之类的东西.虽然基本上看的懂,但很难听清其中一些细致的知识点.于是产生了做中文字幕的想法.本篇分享一下首个已完工的视频,即<beginner Graphics – Lessons系列之摄像机介绍Cameras>.听译.时间轴.压制者均为本人.请勿将视频用于非法目的. 优酷视频好像不太清晰,有需

[我给Unity官方视频教程做中文字幕]beginner Graphics – Lessons系列之灯光介绍Lights

[我给Unity官方视频教程做中文字幕]beginner Graphics – Lessons系列之灯光介绍Lights 既上一篇分享了中文字幕的摄像机介绍Cameras后,本篇分享一下第2个已完工的视频,即<beginner Graphics – Lessons系列之灯光介绍Lights>.听译.时间轴.压制者均为本人.请勿将视频用于非法目的. 有需要高清视频的同学麻烦点个赞并留下你的Email~ 有视频有真相 视频中的重点 类似现实世界,Unity中用灯光照亮场景 没有灯光,场景中的物体在

[我给Unity官方视频教程做中文字幕]beginner Graphics – Lessons系列之纹理Textures

[我给Unity官方视频教程做中文字幕]beginner Graphics – Lessons系列之纹理Textures 本篇分享一下第6个已完工的视频,即<beginner Graphics – Lessons系列之纹理Textures>.听译.时间轴.压制者均为本人.请勿将视频用于非法目的. 有需要高清视频的同学麻烦点个赞并留下你的Email~ 有视频有真相 视频中的重点 纹理是一个图片文件 Unity有多种使用纹理的方式最常见的方式是把纹理赋给网格的基础纹理属性使网格具有纹理的表面 纹理

[我给Unity官方视频教程做中文字幕]beginner Graphics – Lessons系列之网格Meshes

[我给Unity官方视频教程做中文字幕]beginner Graphics – Lessons系列之网格Meshes 本篇分享一下第5个已完工的视频,即<beginner Graphics – Lessons系列之网格Meshes>.听译.时间轴.压制者均为本人.请勿将视频用于非法目的. 有需要高清视频的同学麻烦点个赞并留下你的Email~ 有视频有真相 视频中的重点 Unity中的物体是由3D网格或多边形网格构成的 无论是角色只在一个平面上的简单的2D游戏 还是一个使用精灵(贴图)的复杂的粒