0% found this document useful (0 votes)
19 views

SQL

The document describes SQL commands for creating a student table, inserting data, selecting data, ordering results, using aggregate functions, grouping with HAVING, and subqueries.

Uploaded by

Rajkumar Manala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

SQL

The document describes SQL commands for creating a student table, inserting data, selecting data, ordering results, using aggregate functions, grouping with HAVING, and subqueries.

Uploaded by

Rajkumar Manala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Create table student

(
Rollno Number,
Name Varchar2(10),
Age Number,
Marks Number,
Section Char,
);
// to check the table
Select *
From Student
// insert into table
insert into student
values(1,'Raju',23,80,'A');

insert into student


values(2,'Appu',20,90,'B');

output of this queary is


1 row is inserted
1 row is inserted
// to select all the tables
Select *
From students;
// display null
Select *
from student
Where marks is null;

SYNTAX:

Where <coloum name> is null


// order in ascending or descending
SYNTAX:

Order by <column name> asc/desc

ex:
Select *
from student
order by name desc

// aggregate functions
select *
from student
where max(age) or min(age) or sum(marks) or avg(salary)

//using having clause


select deptno,count(*)
from emp
group by deptno
having count(*)>=2

means it will provid only the count which is having equal or above 2
//subquery

Select *
from emp
where deptno = (select deptno
from dept
where loc= 'mumbai');

You might also like