0% found this document useful (0 votes)
8 views12 pages

Creating Tables Queries

The document outlines the SQL commands for creating a comprehensive database named 'Student_Management_System' which includes various tables such as Student, Teacher, Librarian, and others. Each table is defined with specific attributes and relationships, including primary and foreign keys to maintain data integrity. The database structure is designed to manage student information, attendance, assignments, fees, and academic calendars effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views12 pages

Creating Tables Queries

The document outlines the SQL commands for creating a comprehensive database named 'Student_Management_System' which includes various tables such as Student, Teacher, Librarian, and others. Each table is defined with specific attributes and relationships, including primary and foreign keys to maintain data integrity. The database structure is designed to manage student information, attendance, assignments, fees, and academic calendars effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

1) Creating Database “Student_Management_System”:-

create database Student_Management_System;

2)Creating Student table:-

CREATE TABLE Student(

Student_Reg_Id Varchar(10) Primary Key,

Roll_Number int(3) Not Null,

First_Name varchar(20) Not Null,

Middle_Name varchar(20),

Last_Name varchar(20),

Email_Id_Primary varchar(20),

Email_Id_Secondary varchar(20),

Mobile_number int(14) Not Null,

Telephone_Number int(14) Not Null,

Password varchar(20) Not Null,

Date_Of_Birth Date Not Null,

Registration_Start_Date DateTime Not Null,

Registration_End_Date DateTime,

Class_Current int(2) Not Null,

Class_Admission int(2),

Section_Id varchar(2),

Gender varchar(10) Not Null,

Transport_Reg_Number varchar(10),

Add_House_Number varchar(50),

Add_Area varchar(50),

Add_City varchar(50) Not Null,

Add_District varchar(50) Not Null,

Add_Pin_Code int(10) Not Null,

Add_State Varchar(20) Not Null,

Add_Country Varchar(20) Not Null

);
26)Creating Table Teacher:-

CREATE TABLE Teacher(

Teacher_Reg_Id varchar(10) Primary Key,

Password varchar(20) Not Null,

First_Name varchar(20) Not Null,

Middle_Name varchar(20),

Last_Name varchar(20),

Email_Id_Primary varchar(20) Not Null,

Email_Id_Secondary varchar(20),

Mobile_Number int(14) Not Null,

Gender varchar(8) Not Null,

Date_Of_Birth Date,

Registration_Start_Date DateTime Not Null,

Registration_End_Date DateTime,

Primary_Subject varchar(10) Not Null,

Secondary_Subject_1 varchar(10),

Secondary_Subject_2 Varchar(10)

);

3)Creating Student_Attendance table:-

CREATE TABLE Student_Attendance(

Student_Reg_id varchar(10),

Foreign Key(Student_Reg_id) REFERENCES Student(Student_Reg_id),

Class int(2) Not Null,

Date Date Not Null,

fStatus int(1) Not Null,

Teacher_Reg_id varchar(10),

Foreign Key(Teacher_Reg_id) REFERENCES Teacher(Teacher_Reg_id)

);
4)Creating Student_Assignment table:-

CREATE TABLE Student_Assignment(

Assignment_Id varchar(10) Primary Key,

Teacher_Reg_id varchar(10),

Foreign Key (Teacher_Reg_id) REFERENCES Teacher(Teacher_Reg_id),

Class int(2) Not Null,

Section varchar(2),

Subject varchar(20) Not Null,

Assignment_detail varchar(1000) Not Null,

Assignment_Date DateTime Not Null,

Assignment__Submission_Date DateTime Not Null

);

5)Creating Download table:-

CREATE TABLE Download(

Download_Id varchar(10) Primary Key,

Teacher_Reg_Id varchar(10),

Foreign Key (Teacher_Reg_Id) REFERENCES Teacher(Teacher_Reg_Id),

Student_Reg_Id varchar(10),

Foreign Key (Student_Reg_Id) REFERENCES Student(Student_Reg_Id),

Class int(2) Not Null,

Subject varchar(20) Not Null,

Assignment_detail varchar(20) Not Null,

Assignment_Date DateTime Not Null,

Assignment__Submission_Date DateTime Not Null

);

6)Creating Student_Academic_Calendar table:-

CREATE TABLE Student_Academic_Calendar(

Year int(4) not null,


Date_Of_Event datetime not null,

Class int(2) not null,

Section varchar(2),

Event_Name varchar(10) not null,

Event_Description varchar(50)

);

7)Creating Fee_Payment_Details table:-

CREATE TABLE Fee_Payment_Details(

Payment_Id varchar(15) Primary Key,

Student_Reg_Id varchar(10),

Foreign Key (Student_Reg_Id) REFERENCES Student (Student_Reg_Id),

Month varchar(10) Not Null,

Payment_Date Date Not Null,

Payment_Amount int(8) Not Null,

Mode_Of_Payment varchar(8) Not Null,

Note varchar(50)

);

8) Creating Librarian table:-

CREATE table Librarian(

Librarian_Reg_Id varchar(10) PRIMARY key not null,

Password varchar(20) Not Null,

First_Name varchar(20) Not Null,

Middle_Name varchar(20),

Last_Name varchar(20),

Email_Id_Primary varchar(20) Not Null,

Email_Id_Secondary varchar(20),

Mobile_Number Integer(14) Not Null,

Gender varchar(10) Not Null,

Date_Of_Birth Date,

Registration_Start_Date DateTime Not Null,


Registration_End_Date DateTime

);

9)Creating table Librarian_Academic_Calendar:-

CREATE table Librarian_Academic_Calendar(

Year int(4) Not Null,

Event_Name varchar(10) Not Null,

Date_of_Event DateTime Not Null,

Event_Description varchar(250)

);

10)Creating table Book_Registration:-

CREATE table Book_Registration(

Book_id Varchar(10) Primary Key,

Book_Name Varchar(15) Not Null,

Book_Author Varchar(20) Not Null,

Published_Year Date,

Price int(5) Not Null,

Date DateTime Not Null,

Detail_description varchar(20),

Category varchar(10) Not Null,

Fine_Amount_lost Integer Not Null,

Fine_Amount_perday Integer Not Null,

Status varchar(10) Not Null,

Return_day int(1) Not Null

);

11)Creating Book_Issue table:-

CREATE TABLE Book_Issue(

Book_Issue_Id varchar(10) Primary Key,

Student_Reg_Id varchar(10),

Foreign Key (Student_Reg_Id) REFERENCES Student(Student_Reg_Id),


Librarian_Reg_Id varchar(10),

Foreign Key (Librarian_Reg_Id) REFERENCES Librarian(Librarian_Reg_Id),

Date_of_issue DateTime Not Null,

Date_of_Submission DateTime,

Book_Id Varchar(10),

Foreign Key (Book_Id) REFERENCES Book_Registration(Book_Id),

Issue_Status varchar(10) Not Null,

Fine_amount_collected int(5)

);

12)Creating Table Bus_Registration:-

CREATE TABLE Bus_Registration(

Bus_Reg_Id varchar(15) Primary Key,

Date_of_Registration DateTime Not Null,

End_Date_of_Service DateTime,

Mrng_Source varchar(20) Not Null,

Mrng_Destination varchar(20) Not Null,

Mrng_Route varchar(100) Not Null,

Mrng_Start_Time Time Not Null,

Mrng_Route_time Time Not Null,

Mrng_End_Time Time Not Null,

Evng_Source varchar(20) Not Null,

Evng_Destination varchar(20) Not Null,

Evng_Route varchar(100) Not Null,

Evng_Start_Time Time Not Null,

Evng_Route_Time Time Not Null,

Evng_End_Time Time Not Null,

Total_Seat int(3) Not Null,

Available_Seat int(3) Not Null,

Driver_Name varchar(20) Not Null,

Driver_Mobile_Number int(14) Not Null,

Conductor_Name varchar(20) Not Null,

Conductor_Mobile_Number int(14) Not Null


);

13)Creating Student_Transport_Registration table:-

CREATE TABLE Student_Transport_Registration(

Transport_Reg_Id varchar(10) Primary Key,

Bus_Reg_Id varchar(15),

Foreign Key (Bus_Reg_Id) REFERENCES Bus_Registration(Bus_Reg_Id),

Monthly_Fee_Amount int(5) Not Null,

Pickup_Point varchar(15) Not Null,

Status varchar(8)

);

14)Adding Foreign key “Transport_Reg_Number” after creation of parent table


“Student_Transport_Registration table”:-

Alter table Student


add foreign key(Transport_Reg_Number)REFERENCES
Student_Transport_Registration(Transport_Reg_Id);

15)Creating Student_Transport_Fee table:-

CREATE TABLE Student_Transport_Fee(

Transport_Payment_Id varchar(10) Primary Key,

Transport_Reg_Id varchar(10),

Foreign Key (Transport_Reg_Id) REFERENCES Student_Transport_Registration(Transport_Reg_Id),

Month varchar(10) Not Null,

Payment_Date DateTime Not Null,

Payment_Amount int(5) Not Null,

Mode_Of_Payment varchar(5) Not Null

);

16)Creating table Transport_Academic_Calendar:-


CREATE TABLE Transport_Academic_Calendar(

Year int(4) Not Null,

Event_Name varchar(10) Not Null,

Date_of_Event DateTime Not Null,

Description varchar(250)

);

17)Creating table Admin_Table:-

CREATE TABLE Admin_Table(

Admin_Reg_Id varchar(10) Primary Key,

Password varchar(20) Not Null,

First_Name varchar(20) Not Null,

Middle_Name varchar(20),

Last_Name varchar(20),

Email_Id_Primary varchar(20) Not Null,

Email_Id_Secondary varchar(20),

Mobile_Number int(14) Not Null,

Gender varchar(8) Not Null,

Date_Of_Birth Date,

Registration_Start_Date DateTime Not Null,

Registration_End_Date DateTime

);

18)Creating Class_Fees_Structure table:-

CREATE TABLE Class_Fees_Structure(

Class int(2) Not Null,

Fees int(5) Not Null,

Date Date Not Null,

Admin_Reg_Id varchar(20),

Foreign Key (Admin_Reg_Id) REFERENCES Admin_Table(Admin_Reg_Id)


);

19)Creating Bus_Fees_Structure table:-

CREATE TABLE Bus_Fees_Structure(

Bus_Reg_Id varchar(10),

Foreign Key (Bus_Reg_Id) REFERENCES Bus_Registration(Bus_Reg_Id),

Fees int(5) Not Null,

Date Date,

Admin_Reg_Id varchar(10),

Foreign Key (Admin_Reg_Id) REFERENCES Admin_Table(Admin_Reg_Id),

Pickup_Point varchar(20) Not Null

);

20)Creating Teacher_Salary_Structure table:-

CREATE TABLE Teacher_Salary_Structure(

Teacher_Reg_Id varchar(10),

Foreign Key (Teacher_Reg_Id) REFERENCES Teacher(Teacher_Reg_Id),

Salary int(8) Not Null,

Date Date Not Null,

Admin_Reg_Id varchar(10),

Foreign Key (Admin_Reg_Id) REFERENCES Admin_Table(Admin_Reg_Id)

);

21)Creating Subject_Table table:-

CREATE TABLE Subject_Table(

Subject_Id int(3) Primary Key,

Subject_Name varchar(10) Not Null,

Teacher_Reg_Id varchar(10),

Foreign Key (Teacher_Reg_Id) REFERENCES Teacher(Teacher_Reg_Id),

Class int(2) Not Null,


Year int(5) Not Null

);

22)Creating Result_Table table:-

CREATE TABLE Result_Table(

Result_Id varchar(10) Primary Key,

Student_Reg_Id varchar(10),

Foreign Key (Student_Reg_Id) REFERENCES Student(Student_Reg_Id),

Admin_Reg_Id varchar(10),

Foreign key (Admin_Reg_Id) REFERENCES Admin_Table(Admin_Reg_Id),

Class int(2) Not Null,

Section varchar(2),

Year int(5) Not Null

);

23)Creating Marks_Table table:-

CREATE TABLE Marks_Table(

Result_Id varchar(10) Primary Key,

Marks_1 varchar(10) Not Null,

Marks_2 varchar(10) Not Null,

Marks_3 varchar(10) Not Null,

Marks_4 Varchar(10) Not Null,

Marks_5 Varchar(10) Not Null,

Marks_6 Varchar(10),

Marks_7 Varchar(10),

Marks_8 Varchar(10),

Marks_9 Varchar(10),

Marks_10 Varchar(10),

Marks_11 Varchar(10),

Marks_12 Varchar(10),

Marks_13 Varchar(10),
Marks_14 Varchar(10),

Marks_15 Varchar(10)

);

24)Creating Feedback table:-

CREATE TABLE Feedback(

Student_Reg_Id varChar(10),

Foreign Key (Student_Reg_Id) REFERENCES Student(Student_Reg_Id),

Teacher_Reg_Id varchar(10),

Foreign Key (Teacher_Reg_Id) REFERENCES Teacher(Teacher_Reg_Id),

Bus_Reg_Id varchar(10),

Foreign Key (Bus_Reg_Id) REFERENCES Bus_Registration(Bus_Reg_Id),

Librarian_Reg_Id varchar(10),

Foreign Key (Librarian_Reg_Id) REFERENCES Librarian(Librarian_Reg_Id),

Feedback varchar(200) Not Null

);

25)Creating TABLE Admin_Academic_Calender:-

CREATE TABLE Admin_Academic_Calender(

Year int(4) Not Null,

Event_Name varchar(10) Not Null,

Date_Of_Event DateTime Not Null,

Description varchar(250)

);

27)Creating Teacher_Salary table:-

CREATE TABLE Teacher_Salary(

Teacher_Reg_Id varchar(10),

Foreign Key (Teacher_Reg_Id) REFERENCES Teacher(Teacher_Reg_Id),

Salary_Month varchar(10) Not Null,


Salary_Year int(5) Not Null,

Amount int(8) Not Null,

Date_Of_Payment Date Not Null,

Transaction_Number varchar(15) Not Null,

Mode_Of_Payment varchar(8) Not Null

);

28)Creating table Teacher_Academic_Calender:-

CREATE TABLE Teacher_Academic_Calendar(

Year int(4) Not Null,

Event_Name varchar(10) Not Null,

Date_Of_Event DateTime Not Null,

Description varchar(250)

);

You might also like