-1
得到與標記學生的頂部三個名字從Oracle數據庫中2代表各科目
假設我有兩個表:
1)學員姓名和卷號
2)表與卷號,主題和標記。爲了從2個表
我想要得到的輸出,它會顯示每個學科名稱前3名的學生。
表的腳本,可用於爲:
CREATE TABLE STUDENT (ROLL_NO INT PRIMARY KEY, NAME VARCHAR(20));
INSERT INTO STUDENT VALUES (1,'NIKHIL');
INSERT INTO STUDENT VALUES (2,'VARUN');
INSERT INTO STUDENT VALUES (3,'NISHANT');
INSERT INTO STUDENT VALUES (4,'VISHAL');
INSERT INTO STUDENT VALUES (5,'GOURAV');
INSERT INTO STUDENT VALUES (6,'HEMANT');
INSERT INTO STUDENT VALUES (7,'SHUBHAM');
INSERT INTO STUDENT VALUES (8,'DHAWAN');
INSERT INTO STUDENT VALUES (9,'GAUTAM');
CREATE TABLE MARKS (ROLL_NO INT, SUBJECT VARCHAR(20), MARKS INT);
INSERT INTO MARKS VALUES('1','MATHS','92');
INSERT INTO MARKS VALUES('1','SCIENCE','80');
INSERT INTO MARKS VALUES('1','ENGLISH','98');
INSERT INTO MARKS VALUES('1','HINDI','81');
INSERT INTO MARKS VALUES('2','MATHS','89');
INSERT INTO MARKS VALUES('2','SCIENCE','100');
INSERT INTO MARKS VALUES('2','ENGLISH','81');
INSERT INTO MARKS VALUES('2','HINDI','82');
INSERT INTO MARKS VALUES('3','MATHS','98');
INSERT INTO MARKS VALUES('3','SCIENCE','92');
INSERT INTO MARKS VALUES('3','ENGLISH','88');
INSERT INTO MARKS VALUES('3','HINDI','83');
INSERT INTO MARKS VALUES('4','MATHS','88');
INSERT INTO MARKS VALUES('4','SCIENCE','82');
INSERT INTO MARKS VALUES('4','ENGLISH','85');
INSERT INTO MARKS VALUES('4','HINDI','97');
INSERT INTO MARKS VALUES('5','MATHS','94');
INSERT INTO MARKS VALUES('5','SCIENCE','90');
INSERT INTO MARKS VALUES('5','ENGLISH','97');
INSERT INTO MARKS VALUES('5','HINDI','89');
INSERT INTO MARKS VALUES('6','MATHS','89');
INSERT INTO MARKS VALUES('6','SCIENCE','82');
INSERT INTO MARKS VALUES('6','ENGLISH','84');
INSERT INTO MARKS VALUES('6','HINDI','85');
INSERT INTO MARKS VALUES('7','MATHS','82');
INSERT INTO MARKS VALUES('7','SCIENCE','100');
INSERT INTO MARKS VALUES('7','ENGLISH','92');
INSERT INTO MARKS VALUES('7','HINDI','98');
INSERT INTO MARKS VALUES('8','MATHS','99');
INSERT INTO MARKS VALUES('8','SCIENCE','91');
INSERT INTO MARKS VALUES('8','ENGLISH','86');
INSERT INTO MARKS VALUES('8','HINDI','82');
INSERT INTO MARKS VALUES('9','MATHS','100');
INSERT INTO MARKS VALUES('9','SCIENCE','95');
INSERT INTO MARKS VALUES('9','ENGLISH','81');
INSERT INTO MARKS VALUES('9','HINDI','81');
預先感謝幫助 我需要在Oracle上運行它
它不是家庭作業或項目,我昨天被某人問過這個問題,我正在找到一種方法來獲得這個答案,所以試着我第一次做了表格腳本,以便我可以玩它,但我無法獲得正確的答案,所以我想在這裏發佈它 –