NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

CREATE TABLE Instructor(
_id int IDENTITY(1,1),
InstructorName varchar(20),
DepartmentId int

)

CREATE TABLE Department(
_id int IDENTITY(100,1),
DepartmentName varchar(20),
)

CREATE TABLE Student(
_id int IDENTITY(700,1),
StudentName varchar(20),
)

CREATE TABLE Course(
_id int IDENTITY(500,1),
CourseName varchar(50),
StudentId varchar(50),
InstructorId varchar(50)
)


INSERT INTO Department VALUES('CSE')
INSERT INTO Department VALUES('IT')
INSERT INTO Department VALUES('ECE')
INSERT INTO Department VALUES('ME')
INSERT INTO Department VALUES('CE')
INSERT INTO Department VALUES('ETC')

INSERT INTO Instructor values ('John',105)
INSERT INTO Instructor values ('Robert',101)
INSERT INTO Instructor values ('James',103)
INSERT INTO Instructor values ('Michael',102)
INSERT INTO Instructor values ('Donald',100)
INSERT INTO Instructor values ('Steve',104)

INSERT INTO Student values('Mark')
INSERT INTO Student values('Ronald')
INSERT INTO Student values('Eldward')
INSERT INTO Student values('Jecob')
INSERT INTO Student values('Garry')
INSERT INTO Student values('Eric')

INSERT INTO Course values('Fundementals of Java',700,1)
INSERT INTO Course values('CORE Mechanical',702,3)
INSERT INTO Course values('CORE Civil',701,4)
INSERT INTO Course values('Fundementals of IT',703,1)
INSERT INTO Course values('CORE Electronics',705,2)
INSERT INTO Course values('Fundementals of ETC',704,5)

SELECT D.DepartmentName, I.InstructorName FROM Department D LEFT JOIN Instructor I ON D._id=I.DepartmentId
SELECT I.InstructorName,D.DepartmentName FROM Instructor I RIGHT JOIN Department D ON D._id=I.DepartmentId
SELECT C.CourseName, S.StudentName FROM Course C JOIN Student S ON C.StudentId=S._id

CREATE PROCEDURE SP_getStudentforAllCourse
AS BEGIN
SELECT C.CourseName, S.StudentName FROM Course C LEFT JOIN Student S ON C.StudentId=S._id
END;
exec SP_getStudentforAllCourse

CREATE PROCEDURE SP_getInsCourseWise
AS BEGIN
select I.InstructorName,C.CourseName from Instructor I LEFT JOIN Course C on I._id=C.InstructorId
END;
exec SP_getInsCourseWise


CREATE PROCEDURE SP_FindInstructor
AS BEGIN
SELECT D.DepartmentName, I.InstructorName FROM Department D LEFT JOIN Instructor I ON D._id=I.DepartmentId
END;

EXEC SP_FindInstructor

CREATE PROCEDURE SP_FindStudentEnrolled3
@Id int
AS BEGIN
SELECT StudentName from Student where _id=(Select StudentId from Course where _id=@Id)
END;

EXEC SP_FindStudentEnrolled3 500

CREATE PROCEDURE SP3
AS BEGIN
RETURN
(Select Count(StudentId) from Course where _id=500)
END;
Declare @count int;
Exec @count=SP3
Print CAST(@count as varchar)

CREATE PROCEDURE SP5
@Id int ,
@count int output
AS BEGIN

Select @count=count(StudentId) from Course where _id=@Id
END;

Declare @s_count int;
Exec SP5 500, @s_count out
Print CAST(@s_count as varchar)










     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.