an anonymous user · August 06, 2022
--create database sadhna;
--use sadhna;
-- create a table
CREATE TABLE emp(eid integer(20) NOT NULL ,
  ename TEXT(100) NOT NULL,
  dept varchar(20) NOT NULL,
  salary INTEGER(20) not NULL, primary key(eid));
-- insert some values
INSERT INTO emp VALUES (1 ,'Ram', 'hr',10000)
INSERT INTO emp VALUES ( 5,'varun', 'it',50000);
--update emp set age='42' where id=1;
--delete FROM emp where id=3;
--delete from emp;
-- fetch some values
--SELECT * FROM emp;

--find name of a person whose salary is  maximum 
--select max(salary) from emp;
--nested values
--select * from emp where salary=(select max(salary) from emp);
select ename from emp where dept in(select dept from emp group by dept having count(*)<2);
(Run the program to view its output)


Please sign up or log in to contribute to the discussion.