Skip to content

nidhica/task4-sql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

SQL Concepts and Examples

This README contains explanations and examples of common SQL concepts, aggregate functions, and queries.


1. What is GROUP BY?

It is used to arrange identical data into groups. We can perform operations on the values of each group.

2.Difference between WHERE and HAVING?

Where is used to filter rows and having is used to filter groups.

3.How does COUNT(*) differ from COUNT(column)?

COUNT(*) counts all rows, including rows with NULL values where as count(column) counts all non-NULL values in that columns.

4.Can you group by multiple columns?

Yes we can group by multiple columns by having other column names after group by separated with commas.

5.What is ROUND() used for?

It is used to round numeric values to a specified number of decimal places.

6.How do you find the highest salary by department?

We can first use group by to group different departments and then use MAX to determine the highest salary of that department.

7.What is the default behavior of GROUP BY?

The default behaviour of group by is not guaranteed. It depends upon order by.

8.Explain AVG and SUM.

AVG(column) returns the average of that particular column values. SUM(column) returns the sum of the column values.

9.How to count distinct values?

We use COUNT(DISTINCT column) to count the number of distinct values.

10.What is an aggregate function?

It performs calculations on multiple rows and returns a single value like count, sum, min, max etc.

Screenshots

1. Using group by

Group by

2. Using where and having

Where Having

3. Using Count(*) and Count(column)

count

4. Using multiple columns

count

5. Using Round

count

6. Highest Salary

count

7. Group by default behaviour

count

8. AVG and SUM

count

9. Distinct values

count

10. Aggregate function

count

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors