0% found this document useful (0 votes)
17 views

Create Table Users

The document creates several database tables to store user, student, business, and visa application information with identity, primary and foreign keys. Relationships are defined between the tables.

Uploaded by

talhacanyon98
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Create Table Users

The document creates several database tables to store user, student, business, and visa application information with identity, primary and foreign keys. Relationships are defined between the tables.

Uploaded by

talhacanyon98
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

create table Users(

UserID int identity(1,1) primary key,


Name varchar(255),
Password varchar(255),
ContactNo varchar(20),
Email varchar(255),
CNIC varchar(25),
PassportID varchar(30)
)

create table TouristInfo(


TouristInfoID int identity(1,1) primary key,
UserID int unique,
SecurityClearanceID varchar(25),
foreign key (UserID) references Users(userID)
on delete cascade
on update set null
);

create table BusinessmanInfo(


BusinessmanInfoID int identity(1,1) primary key,
UserID int unique,
foreign key (UserID) references Users(userID)
on delete cascade
on update set null
);

create table BusinessUser(


BusinessUserID int identity(1,1) primary key,
BusinessmanInfoID int unique,
BusinessName varchar(255),
BusinessType varchar(255),
BusinessRegID int,

foreign key (BusinessmanInfoID) references BusinessmanInfo(BusinessmanInfoID)


on delete cascade
on update set null
);

create table Scholarships(


ScholarshipID int identity(1,1) primary key,
Name varchar(255),
Type varchar(255),
Amount int);

create table StudentInfo(


StudentInfoID int identity(1,1) primary key,
UserID int unique,
ScholarshipID int unique,

foreign key (ScholarshipID) references Scholarships(ScholarshipID)


on delete set null
on update set null,

foreign key (UserID) references Users(userID)


on delete cascade
on update set null,

);

create table SSCInfo(


SSCInfoID int identity(1,1) primary key,
RollNo varchar (100),
InstituteName varchar(255),
Percentage float,
StudentInfoID int unique,
foreign key (StudentInfoID) references StudentInfo(StudentInfoID)
on update set null
on delete cascade
)

create table HSSCInfo(


HSSCInfoID int identity(1,1) primary key,
RollNo varchar (100),
InstituteName varchar(255),
Percentage float,
StudentInfoID int unique,
foreign key (StudentInfoID) references StudentInfo(StudentInfoID)
on update set null
on delete cascade
)

create table UniversityInfo(


UniversityInfoID int identity(1,1) primary key,
RegNo varchar (100),
InstituteName varchar(255),
DegreeName varchar(100),
StartingDate date,
GraduationDate date,
CurrentCGPA float,
StudentInfoID int,
foreign key (StudentInfoID) references StudentInfo(StudentInfoID)
on update set null
on delete cascade
)

create table Business(


BusinessID int identity(1,1) primary key,
BusinessName varchar(255),
BusinessType varchar(255),
);

create table EmployeeBusiness(


EmployeeBusinessID int identity(1,1) primary key,
UserID int unique,
Position varchar(100),
HireDate date,
BusinessID int unique,
foreign key (UserID) references Users(userID)
on delete cascade
on update set null,

foreign key (BusinessID) references Business(BusinessID)


on delete cascade
on update set null
);

create Table Payment(


PaymentID int identity(1,1) primary key,
Amount float,
PaymentMethod varchar(255),
Account varchar(100))

create Table Country(


CountryID int identity(1,1) primary key,
Name varchar(100) )

create table Staff(


StaffID int identity(1,1) primary key,
Name varchar(200),
HireDate Date,
Salary float,
Position varchar(100),
Status varchar(100))

create Table VisaApplication (


VisaApplicationID int identity (1,1) primary key,
Status varchar(100),
PaymentID int unique,
CountryID int unique,
StaffID int,
TimeOfApply time,
TimeOfAction time,
UserID int
foreign key (UserID) references Users(userID)
on delete cascade
on update set null,

foreign key (StaffID) references Staff(StaffID)


on delete cascade
on update set null,

foreign key (CountryID) references Country(CountryID)


on delete cascade
on update set null,

foreign key (PaymentID) references Payment(PaymentID)


on delete cascade
on update set null,

create Table Visa (


VisaID int identity (1,1) primary key,
CountryID int unique,
VisaApplicationID int,
IssueDate time,
ExpiryDate time,
UserID int,
ExtendedID int

foreign key (UserID) references Users(userID)


on delete cascade
on update set null,

foreign key (CountryID) references Country(CountryID)


on delete cascade
on update set null,

foreign key (VisaApplicationID) references VisaApplication(VisaApplicationID)

,
foreign key (ExtendedID) references Visa(VisaID)

You might also like