/*mysql> SELECT SUM(Credits) AS TotalCredits FROM Course;+--------------+| TotalCredits |+--------------+| 13 |+--------------+1 row in set (0.02 sec)*/ /* Create the table */Drop TABLE Course;CREATE TABLE Course ( CourseID INT NOT NULL PRIMARY KEY, Name VARCHAR(50), Credits INT)TYPE = InnoDB;/* Insert data */INSERT INTO Course (CourseID,Name,Credits) VALUES (1,'Java',5);INSERT INTO Course (CourseID,Name,Credits) VALUES (2,'C#',5);INSERT INTO Course (CourseID,Name,Credits) VALUES (3,'JavaScript',3);/* Real command */ SELECT SUM(Credits) AS TotalCredits FROM Course;
Name (required)
email (will not be published) (required)
Website