Microsoft SQL Server
Microsoft SQL Server
21 Years Industry experience, worked in Wipro Infotech, HCL Technologies. 9 years in MPSeDC.
SSMS- SQL Server Management Studio tool used to connect to SQL Server.
Before we go ahead:
https://sqlserverbuilds.blogspot.com/
Free editions- Developer edition and Express edition (support only 10 GB database size)
Commercial editions-
https://www.microsoft.com/en-us/download/details.aspx?id=101064
https://learn.microsoft.com/en-us/sql/ssms/release-notes-ssms?view=sql-server-ver16#1791
https://learn.microsoft.com/en-us/sql/samples/adventureworks-install-configure?view=sql-server-
ver16&tabs=ssms#download-backup-files
MPSeDC environments
Development
Testing
Staging
Production
Create tables
Database Schema
o A schema is a logical collection of database objects such as tables, views, stored
procedures, indexes, triggers, functions.
o Create Schema hrdbo
o Alter Schema <new schema> transfer dbo.Employees
o Create new table in a schema
o One-to-many
o Many-to-many
SELECT * FROM Employee
SELECT * FROM EmployeeSkill
SELECT * FROM SkillDescription
Primary Keys
In SQL Server, a Primary key is a constraint that uniquely identify each row in the table.
A table can have only one primary key.
Foreign Keys
The foreign key establishes the relationship between the two tables
For example, the following Employee table has a foreign key column DepartmentID that links to a
primary key column of the Department table.
ON DELETE CASCADE: When we create a foreign key using the delete cascade option, it
deletes the referencing columns in the child table whenever the referenced row in the
parent table with the primary key is deleted.
In SQL Server, a view is a virtual table. In another word, a view is a name given to a query that
can be used as a table.
Functions in SQL Server contains SQL statements that perform some specific tasks. Functions can
have input parameters and must return a single value or multiple records.
Types of Functions
select Month(getdate())
A stored procedure is a set of T-SQL statements which is compiled and stored in the database.
The stored procedure accepts input and output parameters, executes the SQL statements, and
returns a result set if any.
exec [dbo].[uspGetBillOfMaterials] 749, '2010-03-18'
The trigger is a database object similar to a stored procedure that is executed automatically
when an event occurs in a database
DML triggers are automatically fired when an INSERT, UPDATE or DELETE event occurs on a table.
Shivam.kumar@mp.gov.in
9826134081