sql example

an anonymous user · September 15, 2021 · SQL
create table students(

ID int not null,
NAME varchar(20) not null,
AGE int not null,
Gender varcher(20) not null,
primary key(ID)
);
ALTER TABLE students ADD Email varchar(255);
insert into students values(1,"RAVI",21,"MALE","qwertyu"),
(2,"vicky",24,"MALE",'qwertyu'),
(3,"dharu",19,"FEMALE",'qwertu'),
(4,"Ritu",17,"FEMALE",'wertyu'),
(5,"Hari",15,"MALE",'wertyu'),
(6,"RAVI",21,"MALE","qwertyu"),
(7,"vicky",24,"MALE",'qwertyu'),
(8,"dharu",19,"FEMALE",'qwertu'),
(9,"Ritu",17,"FEMALE",'wertyu'),
(10,"Hari",15,"MALE",'wertyu'),
(11,"Hari",15,"MALE",'wertyu'),
(12,"RAVI",21,"MALE","qwertyu"),
(13,"vicky",24,"MALE",'qwertyu'),
(14,"dharu",19,"FEMALE",'qwertu'),
(15,"Ritu",17,"FEMALE",'wertyu'),
(16,"Hari",15,"MALE",'wertyu');
select max(AGE) from students;
select avg(AGE) from students;
select round(avg(AGE),0) from students;
 select count(name) from students;
 select distinct name from students;
 select name from students where name like "%i";


Comments

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