TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

SQLite COUNT Function

SQLite COUNT Function with history, features, advantages, installation, commands, syntax, datatypes, operators, expressions, databases, table, crud operations, clauses, like, glob, limit, and clause, advance sqlite

<< Back to SQLITE

SQLite COUNT Function

SQLite COUNT Function is used to fetch the total count of an expression.

Syntax:

SELECT COUNT(aggregate_expression)
FROM tables
[WHERE conditions]; 

Syntax when you use MAX function with GROUP BY clause:

SELECT expression1, expression2, ... expression_n
COUNT(aggregate_expression)
FROM tables
[WHERE conditions]
GROUP BY expression1, expression2, ... expression_n; 

Example1:

We have a table named "STUDENT", having the following data:

Sqlite Count function 1

Count all the number of students in the "STUDENT" table where AGE is greater than 22.

SELECT COUNT(*) AS "Number of students"
FROM STUDENT
WHERE AGE > 22;

Output:

Sqlite Count function 2

Example2:

Using GROUP BY clause with COUNT function:

Count the number of students with a specific name where the age is greater than 22 and group by the students by name.

SELECT NAME, COUNT(*) AS "Number Of Students"
FROM STUDENT
WHERE AGE > 22
GROUP BY NAME;

Output:

Sqlite Count function 3
Next TopicSQLite Sum




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf