Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
see a quell
--Sql Server 2014 Express Edition --Batches are separated by 'go' CREATE TABLE Students ( Roll_no int PRIMARY KEY , Student_name varchar(255), ); CREATE TABLE Performance ( Roll_no int, Subject_code char, Marks int, PRIMARY KEY (Roll_no,Subject_code ) ); INSERT INTO Students VALUES ('1','Amit'), ('2','Priya'), ('3','Vinit'), ('4','Rohan'), ('5','Samita'); INSERT INTO Performance VALUES ('1','A','86'), ('1','B','95'), ('1','C','90'), ('2','A','89'), ('2','C','92'), ('3','C','80'); Select * from Students Select * from Performance /* Select sum of marks returning with Student names in a new table from table Performance*/ Select Students.Student_name,sum(Performance.Marks) as SumofMarks from Students join Performance on Students.Roll_no = Performance.Roll_no Group by Students.Student_name Select sum(P.Marks) as Sumofmarks,S.Student_name from Students as S, Performance as P Where P.MarKs > 84 Group by Student_name Select Sum(Performance.MArks) as SumofallMArks from Performance
run
|
edit
|
history
|
help
0
MyDb
Common Table Expression
QLSV
sc
repert
Split name
Shalvika's Query
TEST-A3
Tabela Hospedes BD
Solution 2