Question
construct an ESG of the college database for the entities specified above. Write SQL statements to create these tables in your schema of the class
construct an ESG of the college database for the entities specified above.
Write SQL statements to create these tables in your schema of the class database. You may add additional attributes to the structure of each database table as you deem appropriate. Store these statements in an SQL script file.
Use your SQL script file to create the tables in the class database.
Populate your tables with sample data (at least six records per table).
what this code ouputs?
CREATE TABLE [dbo].[AcademicProgram]( [Pgm#] [int] IDENTITY(1,1) NOT NULL, [PgmName] [varchar](250) NULL, [InsertDateTimeStamp] [datetime] DEFAULT GETDATE(), CONSTRAINT [PK_Pgm#] PRIMARY KEY (Pgm#) );
CREATE TABLE [dbo].[Hall]( [Hall#] [int] IDENTITY(1,1) NOT NULL, [HallName] [varchar](250) NULL, [InsertDateTimeStamp] [datetime] DEFAULT GETDATE(), CONSTRAINT [PK_Hall#] PRIMARY KEY (Hall#) );
CREATE TABLE [dbo].[Staff]( [Staff#] [int] IDENTITY(1,1) NOT NULL, [StaffName] [varchar](250) NULL, [StaffDept#] [varchar](250) NULL, [InsertDateTimeStamp] [datetime] DEFAULT GETDATE(), CONSTRAINT [PK_Staff#] PRIMARY KEY (Staff#) );
CREATE TABLE [dbo].[Course]( [Crs#] [int] IDENTITY(1,1) NOT NULL, [CrsName] [varchar](250) NULL, [CrsDept#] [varchar](250) NULL, [InsertDateTimeStamp] [datetime] DEFAULT GETDATE(), CONSTRAINT [PK_Crs#] PRIMARY KEY (Crs#) );
CREATE TABLE [dbo].[Student]( [Stud#] [int] IDENTITY(1,1) NOT NULL, [StudFName] [varchar](100) NULL, [StudLName] [varchar](100) NULL, [StudSex] [varchar](100) NULL, [StudAddr] [varchar](100) NULL, [StudPgm#] [int] NULL, [StudHall#] [int] NULL, [StudDoB] [DateTime] NULL, [InsertDateTimeStamp] [datetime] DEFAULT GETDATE(), CONSTRAINT [PK_Stud#] PRIMARY KEY (Stud#), CONSTRAINT [FK_AcademicProqram_Pgm#] FOREIGN KEY (StudPgm#) REFERENCES [dbo].[AcademicProgram](Pgm#), CONSTRAINT [FK_Hall_Hall#] FOREIGN KEY (StudHall#) REFERENCES [dbo].[Hall](Hall#) );
CREATE TABLE [dbo].[Pgm_Struct]( [PSPgm#] [int] NULL, [PSCrs#] [int] NULL, [PSCrsSeqn] [varchar](100) NULL, [InsertDateTimeStamp] [datetime] DEFAULT GETDATE(), CONSTRAINT [FK_AcademicProqramstr_Pgm#] FOREIGN KEY (PSPgm#) REFERENCES [dbo].[AcademicProgram](Pgm#), CONSTRAINT [FK_Course_Hall#] FOREIGN KEY (PSCrs#) REFERENCES [dbo].[Course](Crs#) );
CREATE TABLE [dbo].[Division]( [Div#] [int] IDENTITY(1,1) NOT NULL, [DivName] [varchar](100) NULL, [DivHead#] [int] NULL, [InsertDateTimeStamp] [datetime] DEFAULT GETDATE(), CONSTRAINT [PK_Div#] PRIMARY KEY (Div#), CONSTRAINT [FK_Staff_Staff#] FOREIGN KEY (DivHead#) REFERENCES [dbo].[Staff](Staff#) );
CREATE TABLE [dbo].[Department]( [Dept#] [int] IDENTITY(1,1) NOT NULL, [DeptName] [varchar](100) NULL, [DeptHead#] [int] NULL, [DeptDiv#] [int] NULL, [TransactionDateTimeStamp] [datetime] NULL, CONSTRAINT [PK_Dept#] PRIMARY KEY (Dept#), CONSTRAINT [FK_StaffDept_Staff#] FOREIGN KEY (DeptHead#) REFERENCES [dbo].[Staff](Staff#), CONSTRAINT [FK_Division_Div#] FOREIGN KEY (DeptDiv#) REFERENCES [dbo].[Division](Div#), );
Insert into AcademicProgram (PgmName) values('BA Criminology'), ('BA Ethnic Studies'), ('BA Healthcare Services'), ('BA Interdisciplinary Studies'), ('BA Liberal Studies'), ('BA Psychology')
Insert into Hall (HallName) values('A-Block'), ('B-Block'), ('C-Block'), ('D-Block'), ('E-Block'), ('F-Block')
Insert into Staff (StaffName,StaffDept#) Values('Asok','Account'), ('Raju','Store'), ('Naidu','Mantaince'), ('Nag','sales work'), ('Mohan','executive'), ('Usha','clerical')
Insert into Course (CrsName,CrsDept#) Values('B.Tech','CSC Department'), ('M.Tech','IT Department'), ('Web','Web Department'), ('Hotel Management','Hotel Department'), ('CA','CA Department'), ('BJMC','BJMC Department')
Insert into Student (StudFName,StudLName,StudSex,StudAddr,StudPgm#,StudHall#,StudDoB) Values('Kondala','Naidu','Male','Ap',1,1,'2014-11-30'), ('Ko','Rajini','Female','UP',2,2,'2015-12-30'), ('Malla','Nag','Male','Ap',3,3,'2014-11-30'), ('Menda','Raju','Male','Ap',4,4,'2014-11-30'), ('Nowpada','Mohan','Male','Ap',5,5,'2014-11-30'), ('Palla','Latha','Female','Ap',6,1,'2014-11-30')
Insert into Pgm_Struct (PSPgm#,PSCrs#,PSCrsSeqn) Values(1,1,'123'), (2,2,'4345'), (3,3,'231'), (4,4,'324'), (5,5,'5678'), (6,1,'876')
Insert into Division (DivName,DivHead#) Values('A',1), ('B',2), ('C',3), ('D',4), ('E',5), ('F',6)
Insert into Department (DeptName,DeptHead#,DeptDiv#) Values('It',1,1), ('CSC',2,2), ('Tech',3,4), ('EEE',4,1), ('EIE',5,2), ('Mtech',6,1)
Relation Attributes {Stud#, StudFName, StudL Name, Student StudSex, StudAddr, StudPgm#, StudHall#, StudDoB...} Academic Program {Pgm#, PgmName...} Hall {Hall#, HallName ...} {Dept#, DeptName, DeptHead#, Department DeptDiv# Staff (Staff#, StaffName, StaffDept# ... Course {Crs# CrsName, Crs Dept# ...} Primary key Foreign Key StudPgm#references [Stud#] Academic Program.Pgm# StudHall#references Hall. Hall# [Pgm# None [Hall# None DeptHead#references Staff.Staff# [Dept# Dept Div#references Division.Div# (Staff None [Crs# None PSPgm#references [PSPgm# PSCrs# Academic Program.Pgm# PSCrs#references Course.Crs# [Div# Div Head#references Staff Staff# Pgm_Struct {PSPgm#, PSCrs#, PSCrsSegn} Division {Div#, DivName, Div Head# ...} Each relation and each attribute would need additional clarification prior to database construction and table creationStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started