Use of compute clause

Rajni.Shekhar
Posted by Rajni.Shekhar under Sql Server category on | Points: 40 | Views : 1026
---CREATE TABLE
CREATE TABLE STUDENT (Student_ID INT NOT NULL IDENTITY,
Student_Name CHAR(50) NOT NULL,
Marks FLOAT NULL)

----INSERT VALUES IN TABLE
insert into STUDENT values ('STUDENT1', 50)
insert into STUDENT values ('STUDENT2', 40)
insert into STUDENT values ('STUDENT3', 20)
insert into STUDENT values ('STUDENT4', 80)
insert into STUDENT values ('STUDENT5', 90)

---GET MAX MARKS USING COMPUTE CLAUSE
SELECT * FROM STUDENT COMPUTE MAX(MARKS)

---GET SUM OF MARKS USING COMPUTE CLAUSE
SELECT * FROM STUDENT COMPUTE SUM(MARKS)

Comments or Responses

Login to post response