SQL Server Notes
SQL Server Notes
Characters
1) Unicode : All Language >1 char – 2Bytes ( Ihsan Bey- 14Byest)
Data Types : 1:- nChar (4000), 2:- nvarChar (4000), 2:- 3:- nvarChar (Max)... Upto 1GB
2)Non Unicode: English 1 char – 18Bytes ( Ihsan Bey- 7Byest)
Data Types : 1:- Char (8000) ... Fixed Lenght Data , 2:- varChar (8000) ... Variable Lenght
Data, 3:- varChar (Max)... Up to 2GB
IT_Parivaar
--------------------------------------------------------------------------------------
-
Name :Code for School
Author :Mohammad Ihsan Baqaakhil
Date :Feb 28, 2024
Porpuse :This script will create Db and a few table in it to store info
about School
--------------------------------------------------------------------------------------
--
---Create Tables
Create table Course_Master
(
CID inter primary key,
CourseName varchar(40) not null,
Category char(1) null ,Basic/Medium/Advanced
Fee Smallmoney not null; Fee cann not be negative
)
go
(
CID int primary key,
CourseName varchar(40) not null,
Category char(1) not null check (Category ='B' or Category ='M' or Category ='A'),
Fee Smallmoney not null check (Fee> 0)
)
---Insert Data
insert into Course_Master values (10,'Java','B','5000' )
insert into Course_Master values (20,'AdvJava','B','25000' )
insert into Course_Master values (30,'BigData','A','67000' )
insert into Course_Master values (40,'SQL Server','M','23000' )
---Insert data
insert into Students_Master values (1,'HasanKhan','F','G' )
insert into Students_Master values (2,'Ghulam Rahimi','L','U' )
insert into Students_Master values (3,'Haroon Ahmadi','F','U' )
insert into Students_Master values (4,'Tawab Nawab','L','G' )
insert into Students_Master values (5,'Farhad Matin','L','G' )
insert into Students_Master values (6,'Tahir Zahiri','F','G' )
go
---Enrollment_Master
create table Enrolment_Master
(
CID int not null Foreign key References Course_Master(CID),
SID tinyint not null Foreign key References Students_Master(SID),
DOE Datetime not Null,
FWF Bit not null,
Grade char(1) Null check (Grade in ('O','A','B','C'))
)
go
use MIBCourse
go
/********************************************************************************
SPName: PreviouseMonthBankstatment
Author: Mohammad Ihsan
Date : Mar 2nd , 2021
Purpose
********************************************************************************/
create proc use_ProviouseMonthBankStatement
(
@SID int = 40
)
as
begin
print'......................................................................
print' Indian Bank '
print'List of Transactions from Mar 2nd to 20,2021 Report'
print'......................................................................'
end
go
use IBank
go
ddddd
create the follow tables for the banking database
create table customer
(customer_name varchar(15),
customer_street varchar(12) not null,
customer_city varchar(15) not null,
Primary key (customer_name));