Database Query Using SQL
VISIT FOR MOREUPDATES
CREATED BY: SACHIN BHARDWAJ, PGT(CS) KV NO.1 TEZPUR & VINOD KUMAR VERMA , PGT(CS) KV OEF KANPUR
Database Query Using SQL
Lets do practical on DATABASE...
SORTING OUTPUT
By default records will come in the output in the same order in which it was entered. To see the output rows in sorted or arranged in ascending or descending order SQL provide ORDER BY clause. By default output will be ascending order(ASC) to see output in descending order we use DESC clause with ORDER BY.
Select * from emp order by name; (ascending order)
Select * from emp order by salary desc; Select * from emp order by dept asc, salary desc;
AGGREGATE functions
Aggregate function is used to perform calculation on group of rows and return the calculated summary like sum of salary, average of salary etc. Available aggregate functions are ? 1. SUM() 2. AVG() 3. COUNT() 4. MAX() 5. MIN() 6. COUNT(*)
AGGREGATE functions
Empno
Name
Dept
Salary
1
Ravi
Sales
2
Sunny
Sales
3
Shobit
IT
4
Vikram
IT
5
nitin
HR
Select SUM(salary) from emp; Output ? 161000
Select SUM(salary) from emp where dept=`sales'; Output - 59000
24000 35000 30000 27000 45000
AGGREGATE functions
Empno 1 2 3 4 5
Name Ravi Sunny Shobit Vikram nitin
Dept Sales Sales IT IT HR
Salary 24000 35000 30000 27000 45000
Select AVG(salary) from emp; Output ? 32200
Select AVG(salary) from emp where dept=`sales'; Output - 29500
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- class notes
- wincc v7 4 wincc scripting vbs ansi c siemens
- geschäfts verkaufs und lieferbedingungen
- programmatic queries
- senior section informatics practices class xi
- if now sysdate sleep 24 0 dialect
- database query using sql
- kendriya vidyalaya sangathan ranchi region
- if now sysdate sleep 15 0
- a study of sql injection hacking techniques
Related searches
- sql query syntax checker
- export sql query to csv with headers
- using sql in databricks
- sql select query syntax
- ms query sql syntax
- microsoft sql server query syntax
- sql query case statement example
- sql basic query commands
- backup query in sql server
- oracle database 11g to sql 19c
- sql query datetime to date
- how to limit sql query results