-- create a student table CREATE TABLE student ( sid INTEGER PRIMARY KEY, name VARCHAR(30) NOT NULL, gender CHAR(1) NOT NULL, deptid INTEGER NOT null, salary INTEGER NOT null ); -- create a department table create table department( deptid INTEGER PRIMARY key, deptname VARCHAR(10) NOT null ); -- insert some student values INSERT INTO student VALUES (1, 'adnan', 'M',1,5000), (2, 'turjoy', 'F',2,6000), (3, 'helal', 'F',2,2000), (4, 'shovon', 'F',1,9000), (5, 'rajib', 'M',1,8000), (6, 'rinku', 'M',3,15000), (7, 'alif', 'F',3,7000); -- insert some student values insert into department values(1,"CSE"),(2,"EEE"),(3,"CIVIL"); select sum(salary) from student where gender="M" ; select deptid,count(salary) from student where salary>3000 group by deptid ;
To embed this project on your website, copy the following code and paste it into your website's HTML: